ExportWithFormatting - Template File Field (1 Viewer)

EzGoingKev

Registered User.
Local time
Today, 13:07
Joined
Nov 8, 2019
Messages
58
I want to export data from a query into Excel. It is going to be the same data all the time. I want the data formatted a certain way every time.

The ExportWithFormatting command has multiple fields. One is titled "Template File" so I created an Excel template.

I have populated all the fields as needed. In the "Template File" field I tried putting the location where the template file is saved along with the template file's name. The data just exported into a new Excel workbook not using the template.

I tried using just the template name and the result was the same - a new workbook that did not use the template.

What am I doing wrong?
 

vba_php

Forum Troll
Local time
Today, 12:07
Joined
Oct 6, 2019
Messages
2,884
interesting issue. this is MS's documentation:

https://docs.microsoft.com/en-us/of...e-reference/exportwithformatting-macro-action

there seems to be lots 'o options in the action too:



Hopefully you can gain something from this response. If not, I'll delete it. :)
 

Attachments

  • lots_of_options.jpg
    lots_of_options.jpg
    35.8 KB · Views: 169

EzGoingKev

Registered User.
Local time
Today, 13:07
Joined
Nov 8, 2019
Messages
58
vba_php, thanks for the link.

My takeaway from reading that information is that Template File does not mean what I thought it meant and that it will not work for Excel.

If I am wrong then please let me know.
 

vba_php

Forum Troll
Local time
Today, 12:07
Joined
Oct 6, 2019
Messages
2,884
well let's see here....the page says:
The path and file name of a file you want to use as a template for HTML files. The template file is a text file that includes HTML tags and tokens that are unique to Access.
so i would guess that you're right and doing what you want to do is not possible because MS is talking about HTML files being the target of the data being thrown. Even though it *does* say something about *being unique to Access*. My guess would be that the target would have to have a format like this, or something similar.



but really there might not be any way to tell because MS is always so vague in their descriptions. I would say, if no one else here knows, the best way to find out for sure is just run a bunch of tests if you have time. Since MS says nothing in terms of what they mean, that's really the only way to figure it out. Don't ya think? That's what I always do when I'm forced to do anything with a large company.
 

Attachments

  • html_structure_for_macro_action.jpg
    html_structure_for_macro_action.jpg
    17.3 KB · Views: 161

GinaWhipp

AWF VIP
Local time
Today, 13:07
Joined
Jun 21, 2011
Messages
5,723
Hmm, yeah never bothered doing it the way Microsoft says as it never worked right. Instead I create a *Template* of my own and then a Template and Data tab. Drop all the data to the Data tab which is tied to the Template tab. Now this does require VBA but we are right here and can help with that.
 

vba_php

Forum Troll
Local time
Today, 12:07
Joined
Oct 6, 2019
Messages
2,884
Instead I create a *Template* of my own and then a Template and Data tab. Drop all the data to the Data tab which is tied to the Template tab. Now this does require VBA but we are right here and can help with that
it might benefit this gentlemen if you can *show* him what you're talking about, Gina. A sample?
 

GinaWhipp

AWF VIP
Local time
Today, 13:07
Joined
Jun 21, 2011
Messages
5,723
it might benefit this gentlemen if you can *show* him what you're talking about, Gina. A sample?

Was waiting to hear back as some are VERY insistent about not using code. So, saving myself some time by not typing up some some code that will never be used. I have another 15 minutes before my next conference call so answering as much as I can on several Forums.
 

Leo_Polla_Psemata

Registered User.
Local time
Today, 10:07
Joined
Mar 24, 2014
Messages
219
My friend EzGoingKev

I fully understood what are you looking for. Forget macro, go to VBA.
I know nothing from VBA but i made it, so , everyone can make it. It will take you few hours embroidery.
Since last month, i have managed to export with formating and I enjoy performing difficult tasks in my job in seconds
and with unprecedented accuracy.

Have a look on this tread.
Exporting Data from Access to Excel in format

Over there are several other links outside this wonderful site, which can give you.
 

Users who are viewing this thread

Top Bottom