Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to open an excel file (7.0) from access 97 1

Status
Not open for further replies.

Fortisdragon

Technical User
Mar 4, 2003
4
BE
Hello,

I'm new here and I'm starting to "play" with VBA Access.
Despite the Microsoft Tips, I'm able to open a new instance of excel (like an activeX object) but obviously the same command cannot open an xlfiles on a server.

Is someone can help me?

Thanks a lot,
Emmanuël
 
FortisDragon

Try this:

Code:
Dim appUserFile As New Excel.Application

appUserFile.Workbooks.Open ("C:\YourExcelFilename")
appUserFile.Visible = True
Set appUserFile = Nothing

HTH
 
Thanks a lot Baggie!

In fact the answer was between both solutions...
because Access 97 doesn't recognize "New" in your first Line

But... I've wrote the following and it works pretty well!

Dim MyXls As Object
Set MyXls = CreateObject("excel.application")
MyXls.Visible = True
MyXls.Workbooks.Open ("C:\YourExcelFilename")
.../...

So it's still an activeX object and I'm able to control Excel via Access.

Bye and thanks again,
Emmanuël




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top