Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

set column widths in outlook whwn loading a query

Posted on 2016-08-30
2
Medium Priority
?
43 Views
Last Modified: 2016-09-07
I have a query with 3 fields, A,B,C.  When I use DoCmd.OutputTo acOutputQuery, "QueryABC", acFormatHTML, "QABC.htm"  The C column is about half as wide as I would like it to be.  I want to automate these emails so I do not want to change it on each one.  I saw something about using a template but had no luck at all either creating or getting that to work.  How can I get this column wider?

Thanks.
0
Comment
Question by:vmccune
2 Comments
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 2000 total points
ID: 41777157
You don't really have much control over this process, so there's not much you can do, and using a Template would have no impact on the content spit out from the query. That would only control the "body" and such of the HTML document you send.

The only way to do this effectively is build the table yourself, in code, using standard HTML tags. I've done this in the past, and it's not too terribly difficult. You just do something like this;

dim html As String
Dim rst As DAO.Recordset
Set rst = Currentdb.OpenRecordset("SomeQueryOrSQL")
html = "<table><tr><td>ColumnHeader1</td><td>ColumnHeader2</td></tr>"
do Until rst.EOF
  html = html & "<tr><td>" & rst("Column1") & "</td><td>" & rst("Column2") & "</td></tr>"
  rst.MoveNext
Loop
html = html " & </table>

You can size the columns in the first "row" (where the html=<table> blah blah" line is). Consult any HTML tag resource to determine the valid tag attributes you can use.
0
 

Author Comment

by:vmccune
ID: 41788911
Got just what I wanted with this as a starting block.
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By default Outlook 2016 displays only one time zone in the Calendar. The following article explains how to display two time zones in one calendar view.
There can be many situations demanding the conversion of Outlook OST files to PST format and as such, there is no shortage of automated tools to perform this conversion. However, what makes Stellar OST to PST converter stand above the rest? Let us e…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question