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

RunApp Excel Template

Status
Not open for further replies.

wvmbark

Technical User
Feb 12, 2003
135
US
If I open an Excel template, it opens as an .xls file. And when I click "Save", a "Save As" box appears and I can save the new .xls file. I would like the template to open the same way when opened via RunApp in Access.

In Access, I've create a macro to open the template using RunApp with the following in the command line:

"C:\Program Files\Microsoft Office\Office10\Excel.exe" "S:\ACMX and Engineering\AC Maint\Tech Support\\Target List\Target Selection Template.xlt"

The file opens but it opens as a .xlt. So if I click "Save", it overwrites the .xlt file.

Is there a way to open the Excel file via the macro so that it opens to a new .xls file using the template like in the first scenario above.

Thanks!!
 
If anyone has any ideas, I'd really appreciate the help.

Thanks!!
 
wvm,

Try running Excel as a comm object like this ;

Private Sub Command1_Click()

Dim objXL As Object
on error resume next
Set objXL = CreateObject("Excel.Application")
if err = 0 then
objXL.WorkBooks.Add "c:\MyFolder\MyTemplate.xlt"

objXL.Visible = True

Set objXL = Nothing
else
msgbox "Cannot create Excel Application object"
end if

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top