Make DoCmd.OutputTo not working properly with an Excel template

caliandro

New member
Local time
Today, 18:07
Joined
Oct 8, 2024
Messages
13
Hi,
I'm facing the below issue:
With the below code I create the excel file but the format of the sheet is not as the template I want it to be.
Looks the code is not working properly but I'm not receiving any error after running it.
What is wrong?
Thank you

DoCmd.OutputTo acOutputTable, "PO_MILESTONE", acFormatXLSX, Application.CurrentProject.Path & "\" & "XS.xlsx", , "C:\MILESTONE_Template.xltx"
 
You can't use a template file when using OutputTo with Excel. From the MSDN documentation:

DoCmd.OutputTo Parameters​

  • Name: TemplateFile
  • Required/Optional: Optional
  • Data Type: Variant
  • Description: A string expression that's the full name, including the path, of the file you want to use as a template for an HTML, HTX, or ASP file.
 

Users who are viewing this thread

Back
Top Bottom