A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

open word file, browse if not found



 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old August 4th, 2004, 06:33 PM
HeatherD
external usenet poster
 
Posts: n/a
Default open word file, browse if not found

Hi! I'm hoping someone here can help me out with something that has
been frustrating me for awhile...

I want to open a word document from excel (with a button) and if it is
not found i want the open file dialog box to appear for the user to
browse for the document in case it has been moved.

I have come up with the following code and it works well except it
opens two instances of word if the file is not found. if the file is
found, there are no problems. Does anyone know how to fix the code so
that only one instance of excel will be open??



Sub OpenWord()
MyDoc = "C:\Documents and Settings\dickisoh\Desktop\Work\CAA Year
Change Instructions"
On Error GoTo C:
Set WdApp = CreateObject("Word.Application")
WdApp.Visible = True
WdApp.Documents.Open MyDoc
Set WdApp = Nothing
Exit Sub
C: Msg = MsgBox("The CAA Year Change Instructions file cannot be
found." & Chr(13) & "It may have been moved to another location." &
Chr(13) & "Please browse your computer for the file.", vbOKOnly, "File
Not Found")
Call OpenWordDial

End Sub


Sub OpenWordDial()
Dim Wrd As New Word.Application
With Wrd.Dialogs(wdDialogFileOpen)
.Name = "*.doc"
.Show
End With
Set Wrd = Nothing

End Sub


Thanks so much in advance!


---
Message posted from http://www.ExcelForum.com/

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
changes to normal.dot Dianah New Users 7 June 17th, 2004 01:19 AM
Unsafe Attachments Ron Installation & Setup 2 June 9th, 2004 01:55 AM
Productkey problem when installing office 2003 on network Stefan Schreurs Setup, Installing & Configuration 1 June 1st, 2004 11:16 PM
"Excel file locked by [user]" though user is the one trying to open it! Lady Layla Setting up and Configuration 0 May 12th, 2004 02:12 PM
GPO Office 2003 Tony Setup, Installing & Configuration 1 May 12th, 2004 10:42 AM


All times are GMT +1. The time now is 12:16 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.