Manipulate Excel from Access

  • Thread starter Thread starter Mike Collard
  • Start date Start date
M

Mike Collard

I have successfully used the MS Help for the GetObject
code to get a running instance of Excel and open a
workbook MyBook.xls and now I want to manipulate the
workbook. How do I make a reference to the workbook to do
this.

This is an extract of the code that opens the workbook

With MyXL
...
.Application.Visible = True
.Windows("MyBook.xls").Activate


The code works to this point i.e. it opens the workbook
but now I want to refresh the data and do some other
manipulations. This is what I've tried so far:-

Set MyWkBk = ActiveWorkbook

With MyWkBk

.Workbooks("MyBook.xls").RefreshAll

.Range("H2").Select

This bit fails. Some guidance would be appreciated.

Regards

Mike Collard
 
Try

With MyWkBk
.RefreshAll
.Range("H2").Select

Hope This Helps
Gerald Stanley MCSD
 
Back
Top