psimation
asked on
selecting excel sheet to display
I want to have an empty OLE window on my form, and then, once the prog runs, i want to select the excel sheet to display from a normal directory list box. is this possible? Sample code will be appreciated.
look at: http://www.vb2themax.com/Item.asp?PageID=TipBank&ID=68
Use the following code
Option Explicit
Private Sub Command1_Click()
OLE1.SourceDoc ='File to be displayed
OLE1.Action = 0
End Sub
Option Explicit
Private Sub Command1_Click()
OLE1.SourceDoc ='File to be displayed
OLE1.Action = 0
End Sub
ASKER
This is how I tried it from the start, but vb tells me expected line number or statement or label or end of statement.
( that is when I simply say ole1.sourcedoc = C:\WINDOWS\Desktop\xxx.xls )
If I try
ole1.sourcedoc = 'c:\windows....
it says expected expression
Can you help me?
PS, VB6.0
( that is when I simply say ole1.sourcedoc = C:\WINDOWS\Desktop\xxx.xls
If I try
ole1.sourcedoc = 'c:\windows....
it says expected expression
Can you help me?
PS, VB6.0
ASKER
Hey, I got it right, the problem was in the name of the xl file, it had a space in the name, I renamed it and now it works. I will however allocate you the points, just re-answer.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hey, I got it right, the problem was in the name of the xl file, it had a space in the name, I renamed it and now it works. I will however allocate you the points, just re-answer.