AcousticalConsultant
Technical User
In my macro, I shell to dos and run a program. But if the program isn't in the proper location, I obviously get an error. I want to be able to prompt the user and allow him to locate the proper location of the file.
Up to here, everything is fine. My problem is when the user enters the new location, I want to go and change the code accordingly, rather than store the new location in a variable and make the user re-enter its location every time he runs the macro!
Here's a portion of my code if it helps...:
FileLoc = "C:\WINDOWS\FILE.EXT"
On Error GoTo ErrHandlr
myval = Shell("command.com /C " & FileLoc, 6)
ErrHandlr:
If (Error = "File not found" Then
MsgBox "Error Starting Application:" & vbCr & vbCr _
& "Application Location: " & FileLoc & vbCr _
& "Description: " & Err.Description,_
vbCritical, "Error"
Exit Sub
End If
Now rather than use the ErrHandlr, I'd branch to a form where the user can browse (using Common Dialog Box) and find the newly located file.
Thanks in advance!
Pascal
Up to here, everything is fine. My problem is when the user enters the new location, I want to go and change the code accordingly, rather than store the new location in a variable and make the user re-enter its location every time he runs the macro!
Here's a portion of my code if it helps...:
FileLoc = "C:\WINDOWS\FILE.EXT"
On Error GoTo ErrHandlr
myval = Shell("command.com /C " & FileLoc, 6)
ErrHandlr:
If (Error = "File not found" Then
MsgBox "Error Starting Application:" & vbCr & vbCr _
& "Application Location: " & FileLoc & vbCr _
& "Description: " & Err.Description,_
vbCritical, "Error"
Exit Sub
End If
Now rather than use the ErrHandlr, I'd branch to a form where the user can browse (using Common Dialog Box) and find the newly located file.
Thanks in advance!
Pascal