Creating Automation Objects

M

Mike Collard

I have copied some code from MS Help to open an MS Excel
spreadsheet, MySpread.xls, manipulate it and then close
Access.

The following lines are included in the code:

..Application.Visible = True
..Parent.Windows(1).Visible = True

I have a Personal.xls spreadsheet that is normally hidden
but it is counted in the index as 1 so to activate my
chosen spreadsheet I renumbered the above
to .Parent.Windows(2).Visible. But that only works if no
other spreadsheets are open.

How can I change the code so that MySpread.Xls is opened
and made visible i.e. becomes the active sheet, regardless
of how many other spreadsheets are open?

Thanks
 
N

Nikos Yannacopoulos

Mike,

..Parent.Windows("MySpread.xls").Visible = True

should do it.

HTH,
Nikos
 

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