Creating Automation Objects

  • Thread starter Thread starter Mike Collard
  • Start date Start date
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
 
Mike,

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

should do it.

HTH,
Nikos
 
Back
Top