hi
i want to open a workbook
excel
with
vb but it doesn't work
can you help with the code
thanks you
i did put that but it does not work
Application.GetOpenFilename
NewFile = ActiveWorkbook.Name
thanks you
Printable View
hi
i want to open a workbook
excel
with
vb but it doesn't work
can you help with the code
thanks you
i did put that but it does not work
Application.GetOpenFilename
NewFile = ActiveWorkbook.Name
thanks you
The best way in my opinion is to create an instance of excel and tell it to open your file. Here is a sample, it opens the path "c:\test.xls" into excel when the button is clicked and then displays excel:
Code:Private Sub Command1_Click()
Set ex = CreateObject("Excel.Application")
Set book = ex.Workbooks
ex.Visible = True
book.Open "c:\test.xls"
End Sub
It can be done in an even easier way
<code>
Private Sub Form_Load()
Excel.Workbooks.Open ("C:\My Documents\Book5.xls")
Excel.Application.Visible = True
End Sub
</code>
True but this will make your final product larger because you are including the excel runtime files in the references. If you know the end user will have excel, I'd use my way because it makes you product smaller. But it's more of a personal preferance than anything else.