Solved

set column widths in outlook whwn loading a query

Posted on 2016-08-30
2
35 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

When you have clients or friends from around the world, it becomes a challenge to arrange a meeting or effectively manage your time. This is where Outlook's capability to show 2 time zones in one calendar comes in handy.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

734 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