Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Save button - change save to folder

Reply
 
Old 02-25-2009   #1 (permalink)
lonlyboy


 
 

Save button - change save to folder

I am looking to get a script where my users can click a "save" button.
It opens up the "save as" dialog box similiar to the code below. The
reason I like this format is, the actual file name is long and it
shows the default format for the user to see so they name the file
properly.

Sub SaveAll1_Click()
fileSaveName = Application.GetSaveAsFilename( _
InitialFileName:="Name - City, St - Cust# - YYYY-MM.xls", _
filefilter:="Excel Files (*.xls), *.xls", _
Title:="[SAVE AS] Name - City, St - Cust# - YYYY-MM.xls", _
ButtonText:="CLICK HERE TO SAVE")
If fileSaveName <> False Then
MsgBox "Save as " & fileSaveName
End If
End Sub

The issue is, I want it to open up in a different folder so my users
don't have to scroll through to find the proper folder to save it in
everytime. To add to the fun, the folder location would be:
C:\documents and settings\<userid>\desktop\folder\
Obviously the "<userid>" is all based on who is logged into the
machine at the time.

Anyone have any ideas?

My System SpecsSystem Spec
Old 02-26-2009   #2 (permalink)
Jennifer


 
 

Re: Save button - change save to folder

On Feb 25, 9:59*am, lonlyboy <lonly...@xxxxxx> wrote:
Quote:

> I am looking to get a script where my users can click a "save" button.
> It opens up the "save as" dialog box similiar to the code below. *The
> reason I like this format is, the actual file name is long and it
> shows the default format for the user to see so they name the file
> properly.
>
> Sub SaveAll1_Click()
> fileSaveName = Application.GetSaveAsFilename( _
> * * InitialFileName:="Name - City, St - Cust# - YYYY-MM.xls", _
> * * filefilter:="Excel Files (*.xls), *.xls", _
> * * Title:="[SAVE AS] * Name - City, St - Cust# - YYYY-MM.xls", _
> * * ButtonText:="CLICK HERE TO SAVE")
> If fileSaveName <> False Then
> * * MsgBox "Save as " & fileSaveName
> End If
> End Sub
>
> The issue is, I want it to open up in a different folder so my users
> don't have to scroll through to find the proper folder to save it in
> everytime. *To add to the fun, the folder location would be:
> C:\documents and settings\<userid>\desktop\folder\
> Obviously the "<userid>" is all based on who is logged into the
> machine at the time.
>
> Anyone have any ideas?

Here is some code to get the path of the desktop from whatever
computer the script is run on:

Const DESKTOP = &H10&

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(DESKTOP)
Set objFolderItem = objFolder.Self
Wscript.Echo objFolderItem.Path

It's been a while since I've used Excel in a script, but there are
news groups for that. You might want to try
microsoft.public.excel.programming to as the question about how to get
the dialog box to open in a particular directory. But if you want to
force them to save to their desktop, why give a choice? You can use
the desktop path a force a save using the plain "SaveAs" instead of
"GetSaveAsFilename".

HTH,
Jennifer
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Change Default "Save As" Folder Vista mail
Save As Button Wont Appear Live Mail
SAVE AS button will not appear when added to ToolBar Live Mail
Change default "Save" folder Vista file management
How do i change default save folder ? Vista file management


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46