A Microsoft Office (Excel, Word) forum. OfficeFrustration

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   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Inserting data from an ACCESS form into a bookmark in WORD



 
 
Thread Tools Display Modes
  #1  
Old May 18th, 2007, 04:56 PM posted to microsoft.public.access,microsoft.public.access.forms,microsoft.public.access.modulescoding,microsoft.public.access.modulesdaovba,microsoft.public.word.programming,microsoft.public.word.vba.beginners,microsoft.public.word.vba.customization,microsof
Doctorjones_md
external usenet poster
 
Posts: 100
Default 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  
Old May 18th, 2007, 05:58 PM posted to microsoft.public.access.forms,microsoft.public.access.modulesdaovba,microsoft.public.word.programming,microsoft.public.word.vba.beginners,microsoft.public.access
Ken Sheridan
external usenet poster
 
Posts: 3,433
Default 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  
Old May 19th, 2007, 09:35 AM posted to microsoft.public.access.forms,microsoft.public.access.modulesdaovba,microsoft.public.word.programming,microsoft.public.word.vba.beginners
Maurice
external usenet poster
 
Posts: 1,585
Default 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  
Old May 24th, 2007, 01:23 AM posted to microsoft.public.access.forms,microsoft.public.access.modulesdaovba,microsoft.public.word.programming,microsoft.public.word.vba.beginners,microsoft.public.access.modulescoding
Sergey Poberezovskiy
external usenet poster
 
Posts: 1
Default 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  
Old May 24th, 2007, 01:26 PM posted to microsoft.public.access.forms,microsoft.public.access.modulesdaovba,microsoft.public.word.programming,microsoft.public.word.vba.beginners,microsoft.public.access.modulescoding
Paul Shapiro
external usenet poster
 
Posts: 635
Default 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

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:06 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.