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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Inserting data from an ACCESS form into a bookmark in WORD
I have the following code (which opens a NEW Word document and prints the
data from my ACCESS form) -- I need code that will open a specified WORD template and insert the ACCESS data into a specific bookmark. I'm sure this is a simple process, but I'm somewhat frazzled (at this point) and have settled on this option over several previous suggestions. Here's the code I need to modify: ================================== 'The following code outputs the Print Detail data to a NEW Word document 'On Error GoTo Err_Command83_Click 'Dim stDocName As String 'Dim MyForm As Form 'stDocName = "PrintDetails" 'Set MyForm = Screen.ActiveForm 'DoCmd.SelectObject acForm, stDocName, True 'DoCmd.PrintOut 'DoCmd.SelectObject acForm, MyForm.Name, False 'Exit_Command83_Click: 'Exit Sub 'Err_Command83_Click: 'MsgBox Err.Description 'Resume Exit_Command83_Click |
#2
|
|||
|
|||
Inserting data from an ACCESS form into a bookmark in WORD
You can download a file from the link below which includes examples of
various Access to Word automation operations including inserting data into bookmarks in a Word document: http://community.netscape.com/n/pfx/...g=ws-msdevapps Ken Sheridan Stafford, England "Doctorjones_md" wrote: I have the following code (which opens a NEW Word document and prints the data from my ACCESS form) -- I need code that will open a specified WORD template and insert the ACCESS data into a specific bookmark. I'm sure this is a simple process, but I'm somewhat frazzled (at this point) and have settled on this option over several previous suggestions. Here's the code I need to modify: ================================== 'The following code outputs the Print Detail data to a NEW Word document 'On Error GoTo Err_Command83_Click 'Dim stDocName As String 'Dim MyForm As Form 'stDocName = "PrintDetails" 'Set MyForm = Screen.ActiveForm 'DoCmd.SelectObject acForm, stDocName, True 'DoCmd.PrintOut 'DoCmd.SelectObject acForm, MyForm.Name, False 'Exit_Command83_Click: 'Exit Sub 'Err_Command83_Click: 'MsgBox Err.Description 'Resume Exit_Command83_Click |
#3
|
|||
|
|||
Inserting data from an ACCESS form into a bookmark in WORD
This site also has 'tons' of information on automation Access-Word and VV
www.helenfeddema.com -- Maurice Ausum "Doctorjones_md" wrote: I have the following code (which opens a NEW Word document and prints the data from my ACCESS form) -- I need code that will open a specified WORD template and insert the ACCESS data into a specific bookmark. I'm sure this is a simple process, but I'm somewhat frazzled (at this point) and have settled on this option over several previous suggestions. Here's the code I need to modify: ================================== 'The following code outputs the Print Detail data to a NEW Word document 'On Error GoTo Err_Command83_Click 'Dim stDocName As String 'Dim MyForm As Form 'stDocName = "PrintDetails" 'Set MyForm = Screen.ActiveForm 'DoCmd.SelectObject acForm, stDocName, True 'DoCmd.PrintOut 'DoCmd.SelectObject acForm, MyForm.Name, False 'Exit_Command83_Click: 'Exit Sub 'Err_Command83_Click: 'MsgBox Err.Description 'Resume Exit_Command83_Click |
#4
|
|||
|
|||
Inserting data from an ACCESS form into a bookmark in WORD
I think you will need to play with Automation he first print out your form
to a new document, then open Word (Automation) object, open your newly created output, select it all and copy to Clipboard; then open your template, locate the bookmark and paste from the Clipboard. After that you can close the original output and delete the file (some housekeeping) "Doctorjones_md" wrote: I have the following code (which opens a NEW Word document and prints the data from my ACCESS form) -- I need code that will open a specified WORD template and insert the ACCESS data into a specific bookmark. I'm sure this is a simple process, but I'm somewhat frazzled (at this point) and have settled on this option over several previous suggestions. Here's the code I need to modify: ================================== 'The following code outputs the Print Detail data to a NEW Word document 'On Error GoTo Err_Command83_Click 'Dim stDocName As String 'Dim MyForm As Form 'stDocName = "PrintDetails" 'Set MyForm = Screen.ActiveForm 'DoCmd.SelectObject acForm, stDocName, True 'DoCmd.PrintOut 'DoCmd.SelectObject acForm, MyForm.Name, False 'Exit_Command83_Click: 'Exit Sub 'Err_Command83_Click: 'MsgBox Err.Description 'Resume Exit_Command83_Click |
#5
|
|||
|
|||
Inserting data from an ACCESS form into a bookmark in WORD
This code opens a new document from a specified template. The oWord object
has already been initialized to Word.Application. Set oDoc = oWord.Documents.Add(Template:=strTemplate) Here is code that replaces a named bookmark with text: Function ReplaceBookmark( _ oDoc As Word.Document, _ strBookmarkName As String, _ strReplacementText As String) As Boolean 'Replace all occurrences of the bookmark with the replacement text With oDoc.Bookmarks If .Exists(strBookmarkName) Then .Item(strBookmarkName).Range.Text = strReplacementText ReplaceBookmark = True End If End With End Function "Sergey Poberezovskiy" wrote in message ... I think you will need to play with Automation he first print out your form to a new document, then open Word (Automation) object, open your newly created output, select it all and copy to Clipboard; then open your template, locate the bookmark and paste from the Clipboard. After that you can close the original output and delete the file (some housekeeping) "Doctorjones_md" wrote: I have the following code (which opens a NEW Word document and prints the data from my ACCESS form) -- I need code that will open a specified WORD template and insert the ACCESS data into a specific bookmark. I'm sure this is a simple process, but I'm somewhat frazzled (at this point) and have settled on this option over several previous suggestions. Here's the code I need to modify: ================================== 'The following code outputs the Print Detail data to a NEW Word document 'On Error GoTo Err_Command83_Click 'Dim stDocName As String 'Dim MyForm As Form 'stDocName = "PrintDetails" 'Set MyForm = Screen.ActiveForm 'DoCmd.SelectObject acForm, stDocName, True 'DoCmd.PrintOut 'DoCmd.SelectObject acForm, MyForm.Name, False 'Exit_Command83_Click: 'Exit Sub 'Err_Command83_Click: 'MsgBox Err.Description 'Resume Exit_Command83_Click |
Thread Tools | |
Display Modes | |
|
|