Results 1 to 2 of 2
  1. #1
    LindaRuble is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    63

    Use a Template to format Word doc generated from Access VBA button click

    Hello,



    I have already accomplished creating a word document by clicking on a button.
    Here is the code:

    Private Sub CreateWord_Click()
    On Error GoTo cmdOK_Error
    Dim stDocName As String
    stDocName = "Client-Status-Linda"
    DoCmd.OutputTo acOutputQuery, stDocName, acFormatRTF, "Word.rtf", True
    cmdOK_Error:
    Resume Next
    End Sub

    Also, I have attached the generated documented.

    It generates a standard word document, however, I would like to be able to choose colors, font style, etc.


    I know that you can use a template with the OutputTo method, however, I have not been successful in making it work.


    expression.OutputTo(ObjectType, ObjectName, OutputFormat, OutputFile, AutoStart, TemplateFile, Encoding)


    Please let me know how to accomplish generating a word file and formatting it with a template. Any help would be appreciated.



    Thanks


    Linda
    Attached Files Attached Files

  2. #2
    Rod is offline Expert
    Windows 7 32bit Access 2007
    Join Date
    Jun 2011
    Location
    Metro Manila, Philippines
    Posts
    679
    Sorry, I don't think the template helps you. Here's the official MS help; it seems restricted to three types only.

    TemplateFile Optional Variant A string expression that's the full name, including the path, of the file you want to use as a template for an HTML , HTX , or ASP file.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 02-23-2012, 07:21 PM
  2. table generated command button????
    By crabbymcdo in forum Forms
    Replies: 1
    Last Post: 06-24-2011, 04:11 AM
  3. vba code to populat word template in Access 2010
    By graffjohn in forum Programming
    Replies: 2
    Last Post: 06-11-2011, 09:36 PM
  4. Export Excel data to access on a button click
    By Grooz13 in forum Import/Export Data
    Replies: 0
    Last Post: 03-15-2011, 10:02 AM
  5. Click a Button to Run Word Mail Merge...
    By nchesebro in forum Programming
    Replies: 6
    Last Post: 03-09-2011, 01:41 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums