#1
|
|||
|
|||
Run-time Error 5174: Open Word Documents from Excel
Early binding; opening a Word Document from Excel VBA. First time, no error. Starting from then, it returns the error stated in the codes below: How could I fix it? Code:
Public Sub SendToWord() Dim myWord As Word.Application Set myWord = New Word.Application With myWord .Visible = True ''' Run-time Error 5174 ''' Application-defined Error or Object-defined Error myWord.Documents.Open Filename:="1.doc" End With |
#2
|
||||
|
||||
Could be a timing issue. You might need to set up a loop to test whether the Word app has loaded before continuing.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Yes, it might be.
|
#4
|
||||
|
||||
When I google 5174 for VBA/Word, it seems always to be the file-not-found error. Are you sure you're getting the error at the .Visible=True statement rather than the .Open statement? (Of course that doesn't explain why the file may have disappeared, but still, first things first.)
|
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Open Word w Excel & fill Word textboxes w info from Excel fields runtime error 4248 | Joe Patrick | Word VBA | 2 | 01-30-2012 07:23 AM |
Word Visual Basic error - run time error 504 | crazymorton | Word | 11 | 01-13-2012 04:32 AM |
Macro Error 5174 | muster36 | Word VBA | 0 | 08-12-2011 03:34 AM |
Excel Open throws 0x800A03EC error | sword.fish | Excel | 1 | 06-10-2010 09:23 AM |
Excel Files Will Not Open From Documents Normally | tremaine | Excel | 1 | 06-17-2009 08:05 AM |