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!

Hoe to open a new (blank) Excel file. 1

Status
Not open for further replies.

andols

Programmer
Aug 30, 2005
12
SE
Hi I have code that opens a existing excelfile. Se below But how to open a new file, must I have the path to a *,xlt file?

//Anders

Code:
 Dim MyXL As Object    

 Dim objConn As OLEDBWorkspaceFactory

 Set MyXL = GetObject(, "Excel.Application")
 If Err.Number <> 0 Then ExcelWasNotRunning = True
 Err.Clear    ' Clear Err object in case error occurred.
 Set MyXL = GetObject("C:\Projekt\data.xls")
 Set MyXL = Nothing

 

Set MyXL = CreateObject("Excel.Application")
MyXL.Workbooks.Add
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top