|
-
Oct 15th, 2000, 03:06 PM
#1
Thread Starter
New Member
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
-
Oct 15th, 2000, 03:41 PM
#2
Fanatic Member
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
www.RealisticGraphics.net
Running VS.Net Enterprise & VB 6
Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML
MSN Messenger: kmsheff
-
Oct 15th, 2000, 09:44 PM
#3
Lively Member
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>
-
Oct 16th, 2000, 05:34 PM
#4
Fanatic Member
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.
www.RealisticGraphics.net
Running VS.Net Enterprise & VB 6
Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML
MSN Messenger: kmsheff
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|