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

Open Excel template from Acess 2013

Status
Not open for further replies.

Brianfree

Programmer
Feb 6, 2008
220
GB
Hi, when i open an excel template from an Access button the user can overwrite the data and save over the file. How can i get the template to open as a new file (like it i open it from windows explorer?)

This is my code..

Code:
Private Sub Command1_Click()
'Open Enquiry Excel Template

Dim ExcelObject As Object
Set ExcelObject = GetObject("S:\Enquiry Template.xltx")
ExcelObject.Application.Visible = True
ExcelObject.Application.Workbooks(1).Activate
ExcelObject.Windows(1).Visible = True

End Sub

Many thanks

Brian
 
Instead of opening excel file create (get) excel application and add workbook based on the specified template workbook, code with late binding:

Code:
Dim ExcelApp As Object, ExcelWbk as Object
Set ExcelApp = GetObject(, "Excel.Application")
With ExcelApp
    .Visible = True
    Set ExcelWbk = .Workbooks.Add("S:\Enquiry Template.xltx")
End With


combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top