Error 91 - Opening Word from Excel

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
 
A

Anne

Hi Anne,

Check that the users all have the same build ofExceland Work.

http://groups.google.com/group/microsoft.public.excel.programming/bro...

It might yield something.

Greg



Thanks Greg! It took me awhile to get info back from the user, but
the build numbers are different:

mine - Excel 2003 (11.8211.8202) SP3
user - Excel 2003 (11.8169.8172) SP3

Is there any way I can find out what might be diff between these
builds to help me narrow in on the problem?
 
A

Anne

Thanks Greg!  It took me awhile to get info back from the user, but
the build numbers are different:

mine -Excel2003 (11.8211.8202) SP3
user -  Excel2003 (11.8169.8172) SP3

Is there any way I can find out what might be diff between these
builds to help me narrow in on the problem?

Thanks to everyone for the replies. I just wanted to loop back and
post that I finally solved the problem. After having the user update
their applications to the same build number I was using the problem
still persisted. I ended up rewriting the code that opens Word from
Excel to use Late Binding instead of Early Binding. It resolved the
issue!
 

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