I'm not Debra, but I ran your code and it worked fine for me.
Can you step through it and verify that things are ok at each step.
Click within the subroutine and start hitting F8's.
then when Word becomes visible, just maximize that and see what happens at each
bookmark.
Kris Taylor wrote:
Hi Debra,
For some reason, the code I added has not changed anything. Also, I
do have bookmarks implemented. They are Oncor, Workorder and
Serviceorder. I also have the reference working.
My current code looks as follows:
====================================
Sub CopyToWord()
Const wdGoToBookmark = -1
Const wdSaveChanges = -1
Dim ws As Worksheet
Dim r As Long
Dim i As Integer
Dim WdApp As Object
Dim str As String
Dim strFile As String
Dim doc As Object
Set ws = Sheets("Tecumseh")
r = ws.Cells(Rows.Count, 1).End(xlUp).Row
strFile = "C:\Routing Slip.doc"
On Error Resume Next
Set WdApp = GetObject(, "Word.Application")
If Err.Number < 0 Then
Err.Clear
Set WdApp = CreateObject("Word.Application")
End If
WdApp.Documents.Open FileName:=strFile, _
ConfirmConversions:=False, ReadOnly:=False
Set doc = WdApp.ActiveDocument
MsgBox doc.Name
WdApp.Visible = True
With WdApp
.Selection.GoTo What:=wdGoToBookmark, Name:="WorkOrder"
.Selection.TypeText Text:=ws.Cells(r, 1).Value
.Selection.GoTo What:=wdGoToBookmark, Name:="ServiceOrder"
.Selection.TypeText Text:=ws.Cells(r, 3).Value
.Selection.GoTo What:=wdGoToBookmark, Name:="OnCor"
.Selection.TypeText Text:=ws.Cells(r, 2).Value
End With
doc.Close SaveChanges:=wdSaveChanges
Set WdApp = Nothing
End Sub
Thanks for all your time and effort thus far!
Kris Taylor
www.questofages.org
--
Dave Peterson