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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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 | |
|
|
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 |