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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open a specific Excel File

Status
Not open for further replies.

Fortborg

Technical User
Jul 26, 2001
15
0
0
US
Hi,

I've got a database that updates to Excel by exporting a Union Query to a text document and importing in Excel. What I need to is to get my Excel file to open "Excel.xls" from a macro without having to go through any sort of database action first, ie. Update to Excel. I just want to open that Excel file when the macro is run. Any suggestions?

Thanks,
-Fort
 
Use this Fort ...

First, create yourself a little subroutine:
Code:
Public Function OpenExcelFile()

   Dim strPathName As String
   Dim objExcel As Object
   strPathName = &quot;<enter full pathname here>&quot;
   Set objExcel = GetObject(strPathName)
   objExcel.Visible = True

End Function
In your macro, and I'm not too sure about this 'cuz I hate those stinkin' things :)P), using the RunCode action type =OpenExcelFile() into the function name field ...

HTH

Greg

 
This code is a good start, but I haven't been able to make it run correctly. It doesn't even attempt to open the Excel application or fetch the object. I've been shuffling code all morning, I'm out of ideas. Anyone else want to take a crack at it?

Thanks,
Fort
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top