A
Anne
I am stumped. I have a workbook that runs a macro to open a Word
template and copies data from Excel into the word template at bookmark
locations. The workbook works great on most users PCs. There are two
users that are receiving an Error 91 at the point the Word doc tries
to open the template. Since it usually seems to work, I can't figure
out what might be different. I have looked at Reference, Security
settings, and disabling virus software on the user's pc, but it
doesn't matter. I am beginning to think there is something more
direct I need to define in the code. Maybe my statements are too
ambigous to open the word template??
Any help would be appreciated. I am copying the code that creates the
status report below.
-----------------------------
Sub CreateReport1()
'COMPLETE STATUS REPORT
On OnError GoTo EndFile
' Create a Word document using a template
Set WordApp = CreateObject("Word.Application") 'starts word
Set WordDoc = WordApp.Documents.Add("C:\PS Project Templates\PS
Status Report1.dot")
' Hide Make the newly created Word instance
WordApp.Visible = False
'******** Project Name ********
WordApp.Selection.Goto What:=wdGoToBookmark,
Name:="ProjectName"
Worksheets("Budget").Range("A2").Copy
WordApp.Selection.PasteSpecial DataType:=wdPasteText
''******** Budget Baseline ********
WordApp.Selection.Goto What:=wdGoToBookmark,
Name:="BaselineValue"
Worksheets("Summary").Range("G8").Copy
WordApp.Selection.PasteSpecial DataType:=wdPasteText
'******** Budget Spent********
WordApp.Selection.Goto What:=wdGoToBookmark,
Name:="BudgetSpent"
Worksheets("Summary").Range("G9").Copy
WordApp.Selection.PasteSpecial DataType:=wdPasteText
'******** Budget Remainig********
WordApp.Selection.Goto What:=wdGoToBookmark,
Name:="RemainingBudget"
Worksheets("Summary").Range("G10").Copy
WordApp.Selection.PasteSpecial DataType:=wdPasteText
'go to the top of the word doc
WordApp.Selection.Goto What:=wdGoToBookmark, Name:="top"
'-------Make the Word doc visible------------
WordApp.Visible = True
' Clean up
EndFile:
Set WordDoc = Nothing
Set WordApp = Nothing
End Sub
template and copies data from Excel into the word template at bookmark
locations. The workbook works great on most users PCs. There are two
users that are receiving an Error 91 at the point the Word doc tries
to open the template. Since it usually seems to work, I can't figure
out what might be different. I have looked at Reference, Security
settings, and disabling virus software on the user's pc, but it
doesn't matter. I am beginning to think there is something more
direct I need to define in the code. Maybe my statements are too
ambigous to open the word template??
Any help would be appreciated. I am copying the code that creates the
status report below.
-----------------------------
Sub CreateReport1()
'COMPLETE STATUS REPORT
On OnError GoTo EndFile
' Create a Word document using a template
Set WordApp = CreateObject("Word.Application") 'starts word
Set WordDoc = WordApp.Documents.Add("C:\PS Project Templates\PS
Status Report1.dot")
' Hide Make the newly created Word instance
WordApp.Visible = False
'******** Project Name ********
WordApp.Selection.Goto What:=wdGoToBookmark,
Name:="ProjectName"
Worksheets("Budget").Range("A2").Copy
WordApp.Selection.PasteSpecial DataType:=wdPasteText
''******** Budget Baseline ********
WordApp.Selection.Goto What:=wdGoToBookmark,
Name:="BaselineValue"
Worksheets("Summary").Range("G8").Copy
WordApp.Selection.PasteSpecial DataType:=wdPasteText
'******** Budget Spent********
WordApp.Selection.Goto What:=wdGoToBookmark,
Name:="BudgetSpent"
Worksheets("Summary").Range("G9").Copy
WordApp.Selection.PasteSpecial DataType:=wdPasteText
'******** Budget Remainig********
WordApp.Selection.Goto What:=wdGoToBookmark,
Name:="RemainingBudget"
Worksheets("Summary").Range("G10").Copy
WordApp.Selection.PasteSpecial DataType:=wdPasteText
'go to the top of the word doc
WordApp.Selection.Goto What:=wdGoToBookmark, Name:="top"
'-------Make the Word doc visible------------
WordApp.Visible = True
' Clean up
EndFile:
Set WordDoc = Nothing
Set WordApp = Nothing
End Sub