Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-15-2013, 05:12 AM
tinfanide tinfanide is offline Run-time Error 5174: Open Word Documents from Excel Windows 7 64bit Run-time Error 5174: Open Word Documents from Excel Office 2010 32bit
Expert
Run-time Error 5174: Open Word Documents from Excel
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default 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
Reply With Quote
  #2  
Old 10-01-2013, 01:11 AM
macropod's Avatar
macropod macropod is offline Run-time Error 5174: Open Word Documents from Excel Windows 7 32bit Run-time Error 5174: Open Word Documents from Excel Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by tinfanide View Post
Early binding; opening a Word Document from Excel VBA.
First time, no error.
Starting from then, it returns the error
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]
Reply With Quote
  #3  
Old 10-01-2013, 01:23 AM
tinfanide tinfanide is offline Run-time Error 5174: Open Word Documents from Excel Windows 7 64bit Run-time Error 5174: Open Word Documents from Excel Office 2010 32bit
Expert
Run-time Error 5174: Open Word Documents from Excel
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default

Yes, it might be.
Reply With Quote
  #4  
Old 10-01-2013, 07:35 AM
BobBridges's Avatar
BobBridges BobBridges is offline Run-time Error 5174: Open Word Documents from Excel Windows 7 64bit Run-time Error 5174: Open Word Documents from Excel Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
Default

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.)
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run-time Error 5174: Open Word Documents from Excel 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
Run-time Error 5174: Open Word Documents from Excel Excel Open throws 0x800A03EC error sword.fish Excel 1 06-10-2010 09:23 AM
Run-time Error 5174: Open Word Documents from Excel Excel Files Will Not Open From Documents Normally tremaine Excel 1 06-17-2009 08:05 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:51 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft