DoCmd.TransferText acExportHTML

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When using this command above, is there a way to determine the font size of
the final product? I'm exporting a query but need the font size of the
information bigger like 24 font. So I've gotten this far but not sure what
the template would be, like the coding. I tried to make a template to enlarge
the font. This is what I have;
DoCmd.OutputTo acOutputQuery, "Messages", acFormatHTML,
"C:\MessagesForAssociates2.html", 0, "C:\template.html"

The html code for the template is:
<html>
<TABLE BORDER=1 BGCOLOR=#ffffff CELLSPACING=0><FONT FACE="Arial" size ="7"
COLOR=#000000><CAPTION><B>Messages</B></CAPTION></FONT>
</TABLE>
</body>
</html>

What am I doing wrong?
 
I remember looking at how to use template files about a year ago... and
failed to find anything at all. Seems to be one of those things that Access
is supposed to be able to do but nobody knows how.

I ended up just outputting the file without the template, and using code to
open the text file and making the adjustments I needed directly.
 
Rob Oldfield said:
I remember looking at how to use template files about a year ago...
and failed to find anything at all. Seems to be one of those things
that Access is supposed to be able to do but nobody knows how.

I ended up just outputting the file without the template, and using
code to open the text file and making the adjustments I needed
directly.

I was just searching for this the other day, in response to a different
post. There wasn't much, but I did find this:


http://msdn.microsoft.com/library/d...ingapplicationsfortheinternetworldwideweb.asp
 
Rob Oldfield said:
Nice find. I still can't figure out how you'd actually alter the
structure of the output table though. And I don't have the Access 97
example templates available.

That article is the sum total of my knowledge on the subject, I'm
afraid. If *you* happen to find anything, let me know.

<g>
 
Dirk Goldgar said:
That article is the sum total of my knowledge on the subject, I'm
afraid. If *you* happen to find anything, let me know.

<g>

OK. I managed to find a copy of A97. There is one of the templates
attached to the NorthWind db. That looks like this...

<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">

<TITLE><!--ACCESSTEMPLATE_TITLE--></TITLE>
<META NAME="DocumentEn" CONTENT="windows-1252">

</HEAD>
<BODY LINK="#0000ff" VLINK="#800080">
<IMG SRC="NWlogo.GIF"> <FONT SIZE=4 FACE="Book Antiqua">Northwind
Traders</FONT>
<HR>

<!--ACCESSTEMPLATE_BODY--> <BR>
<A HREF="<!--AccessTemplate_FirstPage-->">First</A>
<A HREF="<!--AccessTemplate_PreviousPage-->">Previous</A>
<A HREF="<!--AccessTemplate_NextPage-->">Next</A>
<A HREF="<!--AccessTemplate_LastPage-->">Last</A>

</BODY>
</HTML>

....so you can include a size tag in there - but only at the global level.
The way that the sample uses it, they actually base the output on a report
instead of a query. So acOutputReport instead of acOutputQuery. The html
output then picks up the format from the report - so ....

....although you can include the font size, it only gets applied to the title
text. You can also a font tag to the template

<font size=24>
<A HREF="<!--AccessTemplate_FirstPage-->">First</A>
<A HREF="<!--AccessTemplate_PreviousPage-->">Previous</A>
<A HREF="<!--AccessTemplate_NextPage-->">Next</A>
<A HREF="<!--AccessTemplate_LastPage-->">Last</A>
</font>

....and that will be applied to those links.

Borders... there doesn't seem to be any way of applying those. Think you'd
have to fall back on editing the text file.

So, to summarise, it seems that you can use the template to format header
and footer information, but the actual body is determined by formatting
applied in Access, which is why you'd normally use a report instead of a
query.

There are some other sample template documents but they just seem to be
doing things like setting background graphics.... e.g.....

<HTML>
<TITLE><!--ACCESSTEMPLATE_TITLE--></TITLE>
<BODY background = sky.jpg>
<!--ACCESSTEMPLATE_BODY-->
</BODY>
<BR><BR>
<IMG SRC = "msaccess.jpg">
</HTML>

If anyone wants to see those, let me have a mail address and I'll forward
them.
 
Rob Oldfield said:
OK. I managed to find a copy of A97. There is one of the templates
attached to the NorthWind db. That looks like this...

<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;
charset=windows-1252">

<TITLE><!--ACCESSTEMPLATE_TITLE--></TITLE>
<META NAME="DocumentEn" CONTENT="windows-1252">

</HEAD>
<BODY LINK="#0000ff" VLINK="#800080">
<IMG SRC="NWlogo.GIF"> <FONT SIZE=4 FACE="Book Antiqua">Northwind
Traders</FONT>
<HR>

<!--ACCESSTEMPLATE_BODY--> <BR>
<A HREF="<!--AccessTemplate_FirstPage-->">First</A>
<A HREF="<!--AccessTemplate_PreviousPage-->">Previous</A>
<A HREF="<!--AccessTemplate_NextPage-->">Next</A>
<A HREF="<!--AccessTemplate_LastPage-->">Last</A>

</BODY>
</HTML>

...so you can include a size tag in there - but only at the global
level. The way that the sample uses it, they actually base the output
on a report instead of a query. So acOutputReport instead of
acOutputQuery. The html output then picks up the format from the
report - so ....

...although you can include the font size, it only gets applied to
the title text. You can also a font tag to the template

<font size=24>
<A HREF="<!--AccessTemplate_FirstPage-->">First</A>
<A HREF="<!--AccessTemplate_PreviousPage-->">Previous</A>
<A HREF="<!--AccessTemplate_NextPage-->">Next</A>
<A HREF="<!--AccessTemplate_LastPage-->">Last</A>
</font>

...and that will be applied to those links.

Borders... there doesn't seem to be any way of applying those. Think
you'd have to fall back on editing the text file.

So, to summarise, it seems that you can use the template to format
header and footer information, but the actual body is determined by
formatting applied in Access, which is why you'd normally use a
report instead of a query.

There are some other sample template documents but they just seem to
be doing things like setting background graphics.... e.g.....

<HTML>
<TITLE><!--ACCESSTEMPLATE_TITLE--></TITLE>
<BODY background = sky.jpg>
<!--ACCESSTEMPLATE_BODY-->
</BODY>
<BR><BR>
<IMG SRC = "msaccess.jpg">
</HTML>

If anyone wants to see those, let me have a mail address and I'll
forward them.

Thanks for posting the results of your research, Rob. I'll tuck this
away in case I ever have a use for it.
 
This is controlled by the query being run, not by the template. To
change the output font:
1. Run your query.
2. When you have the query results in a table in your screen, from the
Format menu, choose font.
3. Set the font options you want. Click OK.
4. Click the Save button.

Now, when you run the OutputTo command, it will use the font settings
saved in the query.
 
Back
Top