unbound object

M

marolb

hi,
i am trying to add an unbound object (OLE Type: linked). It is an excel
file: mydoc.xls.
It seems that the link shows only the sheet that was last saved in Excel.

Say, if i have sheet_A & sheet_Bin mydoc.xls.
If i save sheet_A, then sheet_A is shown in the report.
If i re-open mydoc.xls and i save sheet_B, then sheet_B is shown....

How can i reference a certain sheet (say: sheetA), whtever i save in Excel??!
Thanx in advance...
 
R

Rob

you need to create a reference to an excel object, and
then make references to each sheet.

do something like this:

Dim xlapp as Object
Dim xlbook as Object
Dim xlsheetA as Object
Dim xlsheetB as Object

Set xlapp = New Excel.Application
Set xlbook = xlapp.Workbooks.Open(*Path and Filename here*)
Set xlsheetA = xlapp.Worksheets("sheet_A")
Set xlsheetB = xlapp.Worksheets("sheet_B")

you should then be able to choose which sheet you show in
your unbound OLE object by using the xlsheetA or xlsheetB
references you've just created.

i hope this helps!
 
M

marolb

hi rob, thx for the info. however, the excel sheet already exists and the
thing is i don't know wht is code to reference unbound OLE object ! where
should i put the reference to the excel sheet and the excel file.
thx. appreciate it
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top