Thread: beforeclose
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
smartin smartin is offline
external usenet poster
 
Posts: 915
Default beforeclose

Curt wrote:
need help out of starting gate
Useing beforeclose want to ask used where to save would like to have a
userform with choices before I get into this does it seem the right way to go
or has someone been there befor with a better solution? I think doing it in
this manner different drives should be abled.
Thank You


Hi Curt,

If you want to limit save locations to a fixed list of relatively few
options, you could place a ComboBox (or ListBox) on the form and
populate it at runtime. Then you obtain the user's selection when they
click "Save" or whatever and translate the result into a pathname.

The code for this is simple, but the down-side is the list must be
maintained in code. That said, there are ways to make this method
dynamic by looking for the values in an external source.

Form_Initialize:
Combobox1.additem "Location 1"
Combobox1.additem "Location 2"

cmdSave_click():
Select Case Combobox1.Value
Case "Location 1"
MyPath = "C:\UserDocs\"
Case "Location 2"
MyPath = "\\server\share\UserPath\"
End Select


Alternatively, if you would rather allow the user to browse for a
location, you can invoke the Windows Save dialog. It's been some time
since I used this so offhand I don't remember how but I'm sure I (or
someone) can dig it up.