Link to home
Start Free TrialLog in
Avatar of psimation
psimationFlag for South Africa

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.
Avatar of roverm
roverm
Flag of Netherlands image

Avatar of adityau
adityau

Use the following code

Option Explicit

Private Sub Command1_Click()
    OLE1.SourceDoc ='File to be displayed
    OLE1.Action = 0
End Sub
Avatar of psimation

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
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
Avatar of adityau
adityau

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.