probably simple Word VBA query

P

pvp

I am on Office XP. In my Access VBA, I have the following
code:
"
' magic to get document as it IS expected and IS
there...
' unusual error catching to stuff further down
On Error GoTo createApp ' create a Word app
Set docApp = GetObject(, "Word.Application")
On Error GoTo wasntthere
' get the actual doc
Set docDoc = docApp.Documents.Open("C:\program
files\counselog\counselog docs\" & Me.Text51 & ".doc")
On Error GoTo 0

' goto end of doc and stick in new text
junk = docApp.Selection.EndKey(Unit:=6, Extend:=0)
docApp.Selection.Font.name = "Times New Roman"
docApp.Selection.Font.Bold = False
docApp.Selection.Font.Size = 13

docApp.Selection.typetext "___________________________" &
vbCrLf
docApp.Selection.typetext "Session Comment on " &
Format(Now, "MMMM dd, yyyy at hh:mm AM/PM")
docApp.Selection.typetext vbCrLf & vbCrLf
"

When the Word doc opens, it has all I specified above in
it. I want the cursor to be at the end, however, and I
can't seem to find the way to do it: endKey doews not
seem to work although it obviously does at the satrt....

Heeeeeeeeeeeeelp!

Thanks.
 
G

Guest

I added at the end of the relevant code
"
Selection.Move Unit:=wdStory, Count:=1
"

but that did not work either.

Any other thoughts?

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top