Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-08-2012, 07:20 AM
coconutt coconutt is offline macro to open another document Windows XP macro to open another document Office 2007
Novice
macro to open another document
 
Join Date: May 2012
Posts: 10
coconutt is on a distinguished road
Default macro to open another document

Hello, I have a macro that i execute within the document to open another word docx. When I exit the document i get this error.


Sub OPENBARCODE()
'
' OPENBARCODE Macro
'
'
Dim WordApp As Object
Dim WordDoc As Object

Set WordApp = CreateObject("Word.Application")
Set WordDoc = WordApp.Documents.Open(FileName:="C:\Documents and Settings\Administrator\Desktop\sMD1.docx")


WordApp.Visible = True

Set WordDoc = Nothing
Set WordApp = Nothing

End Sub
Any thoughts?
Reply With Quote
  #2  
Old 06-11-2012, 04:39 AM
macropod's Avatar
macropod macropod is offline macro to open another document Windows 7 64bit macro to open another document Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Hi coconutt,

Your 'error message' image doesn't display, so it's not possible to comment on what the issue might be. If you're still having difficulty, please post back with the actual text of the error message, and tell us which code line (if any) is highlighted.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
macro to open another document Macro to Open to a Website When No Document Is Open lostinwebspace Word VBA 1 02-13-2016 10:28 AM
Save As Macro using first line of document as document name redzan Word VBA 1 01-31-2015 09:24 PM
macro to open another document Run-time error '1004': Document not saved. The document may be open... doctor_who12 Excel Programming 1 01-22-2014 04:47 PM
macro to open another document can I run a macro when I open a specific doc ?? ximpostor Word VBA 10 10-12-2012 12:35 PM
can I run a macro when I open a specific doc. shreked Word 8 01-12-2012 03:36 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:24 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