Results 1 to 5 of 5

Thread: [RESOLVED] what is wrong with my code?

Threaded View

  1. #1

    Thread Starter
    Lively Member elmnas's Avatar
    Join Date
    Jul 2009
    Posts
    127

    Resolved [RESOLVED] what is wrong with my code?

    hi people,

    I have made following code but I can't open the file why?

    see code below:


    Code:
    Imports excel = Microsoft.Office.Interop.Excel
    Public Class Form1
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    
    
            Dim dlg As New OpenFileDialog
    
            dlg.Filter = " Excel-Arbetsbok(*.xlsx)|*.xlsx|Excel 97-2003-arbetsbok (*.xls)|*.xls)"
            dlg.ShowDialog()
            Dim FPath As String = IO.Path.GetDirectoryName(dlg.FileName)
    
            Dim XlApp As New Microsoft.Office.Interop.Excel.Application()
            Dim wb As Microsoft.Office.Interop.Excel.Workbook = XlApp.Workbooks.Open(FPath & dlg.FileName.ToString())
    
            XlApp.Visible = True
    
    
        End Sub
    No code erros but it says: Couldn't find the file C:\xxx\xxx.test.xlsx is the file moved? renamed or deleted
    Last edited by dday9; Dec 1st, 2015 at 11:24 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width