Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Opening a Word Doc from Excel

  Asked By: Madeline    Date: Oct 18    Category: MS Office    Views: 790
  

I'm trying to open an existing word doc from excel, and then preforming some
process like copying sheets to the doc.
My whole problem is in getting the word application to open properly.

Here's my code:

Dim TempDoc As Word.Document

Sub Selectdoc()
NewFN = Application.GetOpenFilename(FileFilter:="Doc Files (*.Doc), *.Doc",
Title:="Please select a file")
If NewFN = False Then
' They pressed Cancel
MsgBox "Stopping because you did not select a file"
Exit Sub
Else

Set TempDoc = Word.Documents.Open(NewFN)


End If
End Sub

The first few times I ran the code it worked just fine and opened the doc I
selected. Recently it gives me an error "Error 429 (ActiveX Component Can't
Create Object)" when I run it.
I tried to open the word application first and then run the code, then I
didn't get that error any more and it worked fine.
Now I'm trying to run it....and I'm getting another kind of error: Run time
error "Method Open of Objects Document failed"!

It's wierd that the results are so unstable, one time its working another
time these errors.... does anyone have experience with this? I'm running
windows NT and Office 2000. Are there any known bugs with these versions or
is it something with my code?

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Opening a Word Doc from Excel Or get search suggestion and latest updates.




Tagged: