Write Access Query to Word Bookmark
Write Access Query to Word Bookmark, MsAccessGurus

Write Access Query to Word Bookmark

See an Access query in a Word document, written after a bookmark in a pretty table.

Download the code from MsAccessGurus:

Write Access Query To Word Bookmark using VBA

https://msaccessgurus.com/VBA/aWord_QueryToBookmark.htm

STEPS

1. Make a query with the information you want in a Word table

2. Open a Word Document

3. Create a bookmark where you want the table

from ribbon: Insert, Bookmark (Links group), [enter Bookmark name] and click Add

4. CUSTOMIZE Word_QueryToTableBookmark_s4p with your query name and your bookmark name

5. compile, save, and run the code from Access

By default, your field names will be the column headings for the table. They will be shaded and marked as a header row to repeat in case the table is on more than one page.

Also by default, the table will have gray borders around data cells and black borders on the heading cells.

You can also do additional formatting on any column once the table is written by customizing and calling Word_CustomFormatColumn_s4p.

Although the code is written for you to specify query and bookmark name to run once, you could easily store bookmarks and query names in an Access table then loop and write several tables to your Word document.

If you loop, you may also want to make the table Caption a parameter. Currently, it writes the query name along with the number of rows and columns. If a caption isn't specified, it is skipped.

Something else you might like is an easy way to show or hide the bookmark indicators in your Word documents:

Toggle Bookmark Display in Word using VBA

https://msaccessgurus.com/VBA/aWord_BookmarksShowNotshow.htm

See your Access queries in Word tables with a nice, consistent look.

kind regards, crystal

#VBA #msaccess #microsoftaccess #dev #developer #office365 #m365 #msword #query #table #borders #shading

Rona Rose

MS Access database developer

6 个月

code in demand!

Garry Smith

Business Owner

6 个月

Thank you, Crystal, for sharing these procedures. Any chance you will be making a video on this subject?

要查看或添加评论,请登录

crystal (strive4peace)的更多文章

  • Change 365 Version for Office

    Change 365 Version for Office

    I recently had an issue with 365 forgetting who I am (it had the wrong account) and also the January 7 rollout (which I…

    4 条评论
  • Monaco SQL Editor for Access

    Monaco SQL Editor for Access

    The long-awaited Monaco SQL Editor to help you visualize your queries is rolling out for Microsoft Access. Those on 365…

    1 条评论
  • Dive into, and Document, Access Relationships and Indexes

    Dive into, and Document, Access Relationships and Indexes

    Relationships define how tables are joined. A common method is to join an AutoNumber primary key in the parent table…

    7 条评论
  • Valuable Video Vessel

    Valuable Video Vessel

    Videos help you visualize and learn. When you find a great channel on YouTube and want to play all their videos, how do…

    4 条评论
  • How Does Sorting Work with VBA?

    How Does Sorting Work with VBA?

    How does sorting a list of values work? It's easier than you might think. Bubble Sort is a simple method.

  • See your Queries better

    See your Queries better

    Get a list of all the query names in your Access database, along with what type of query each is. Do you ever want a…

    17 条评论
  • Visualize Access Relationships with Words

    Visualize Access Relationships with Words

    The relationships diagram in Access is a great way to see what's in your database, but how can you get a list of the…

  • Make Access Tab Control Pages come alive

    Make Access Tab Control Pages come alive

    Tab Controls are a great way to organize information on your busy Access forms. They have Pages where you can place…

    6 条评论
  • Make Big Checkboxes any Size and Color you want

    Make Big Checkboxes any Size and Color you want

    Say goodbye to tiny checkboxes with no color! Hello Unicode! Make checkboxes any size and color you want. Simply…

    5 条评论
  • Get Character with Access and Unicode

    Get Character with Access and Unicode

    Do you want to add imagination to your applications? Use the free Unicode Character Map tool in Access to find…

    2 条评论

社区洞察

其他会员也浏览了