If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Use a Template to format Word doc generated from Access VBA button click

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Nov 2012
Posts: 1
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
File Type: zip Word.zip (12.8 KB, 3 views)
Reply With Quote
Reply

Tags
access database, button control, vba, word template

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On