Kenny G was telling us:
Kenny G nous racontait que :
> Hello,
>
[quoted text clipped - 7 lines]
>
> I get an error message: Object required.
Three things:
1) You are opening a template, not creating a document form a template.
2) Why don't you use a Document object instead of working with the
unreliable ActiveDocument?
3) You may want to check if Word is already running before creating a new
instance...
See my suggestions below:
> Here is the code. Perhaps you might be able to tell me what is
> missing.
Sub PrintHazSurvRptWithWord(DataEntryForm)
Dim objWord As Word.Application
Dim objDoc As Word.Document
'Launch Word and create a document from
'the HazardSurveillanceReport template
Set objWord = New Word.Application
> objWord.Documents.Open "\\Sharedir\safety
> database\Documents\HazardSurveillanceSurvey.dot"
> objWord.ActiveDocument.FollowHyperlink "\\Sharedir\safety
> database\Documents\HazardSurveillanceSurvey.dot"
(Why open template and then follow a hyperlink to the same template?)
objWord.Visible = True
Set objDoc =
objWord.Documents.Add("\\Sharedir\safetydatabase\Documents\HazardSurveillanceSurvey.dot")
'Add information using predefined bookmarks
With objDoc.Bookmarks
.Item("Director").Range.Text = ReportPrintForm.Director
etc.

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
Kenny G - 08 Apr 2005 19:01 GMT
Jean-Guy,
Thanks for your assistance. The errors you pointed out were corrected and
it works with no error message, but, my Bookmarks come up empty. I see the
"I" bar and when I open tools, bookmarks I see my bookmarks listed and I can
GoTo each one and the cursor moved to each bookmark. Is there possibly a
missing connection?
Thanks,
> Kenny G was telling us:
> Kenny G nous racontait que :
[quoted text clipped - 48 lines]
>
> etc.
Jean-Guy Marcil - 09 Apr 2005 04:21 GMT
Kenny G was telling us:
Kenny G nous racontait que :
> Jean-Guy,
>
[quoted text clipped - 3 lines]
> my bookmarks listed and I can GoTo each one and the cursor moved to
> each bookmark. Is there possibly a missing connection?
Have you stepped through the code to make sure the values are being passed
from Access to Word?

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
Kenny G - 11 Apr 2005 16:26 GMT
Jean-Guy,
No, I have never do anything like that before. Is this done through the
Visual Basic Editor?
Ken
> Kenny G was telling us:
> Kenny G nous racontait que :
[quoted text clipped - 9 lines]
> Have you stepped through the code to make sure the values are being passed
> from Access to Word?
Jean-Guy Marcil - 12 Apr 2005 02:49 GMT
Kenny G was telling us:
Kenny G nous racontait que :
> Jean-Guy,
>
> No, I have never do anything like that before. Is this done through
> the Visual Basic Editor?
Yes. Place the cursor in the main procedure.
F5 will launch the whole procedure. If you have set break (or used STOP) the
execution will stop on those lines.
Also, F8 executes line by line. In View, display the Local window to see
what is going on with your variables.

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
Kenny G - 12 Apr 2005 18:00 GMT
Jean_Guy,
Many thanks for your help. This will help me a lot.
Kenny G
> Kenny G was telling us:
> Kenny G nous racontait que :
[quoted text clipped - 9 lines]
> Also, F8 executes line by line. In View, display the Local window to see
> what is going on with your variables.