If you are going against a particular file (for example:Your File.xls), then go to the menu TOOLS-REFERENCE.
Code:Dim MyXL As Object Dim ExcelWasNotRunning As Boolean On Error Resume Next 'If the application isn't running, an error occurs Set MyXL = GetObject(, "Excel.Application") If Err.Number <> 0 Then ExcelWasNotRunning = True Err.Clear ' Set the object variable to reference the file you want to see. Set MyXL = GetObject("c:\Trash\sara.xls") ' Show Microsoft Excel through its Application property. Then ' show the actual window containing the file using the Windows ' collection of the MyXL object reference. MyXL.Application.Visible = True MyXL.Parent.Windows(1).Visible = True ' Do manipulations of your file here If ExcelWasNotRunning = True Then MyXL.Application.Quit Set MyXL = Nothing
If you just want to create a new file, then you don't need to reference
Code exactly the way you would in Excel, but place the "xlApp." infrontCode:Dim xlApp As Object Set xlApp = CreateObject("Excel.Application") xlApp.Visible = True xlApp.Visible = True xlApp.Quit Set xlApp = Nothing
[Edited by Nitro on 04-21-2000 at 11:10 PM]




Reply With Quote