ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Directing a Save As in VBA (https://www.excelbanter.com/excel-programming/338963-directing-save-vba.html)

ngarland13

Directing a Save As in VBA
 

Hi,

I am working on a tool, and when it opens I want it to immediatly do a
save as (I have it read only, and can get the save as to come up, but i
don't want anyone saving the tool where the save as pops up, I want it
to co to their C/Data folder).

The last line in my auto open vba code is below, and that brings up the
save as screen, but i want to direct it to go to C/Data, any help would
be appreciated.

"Application.Dialogs(xlDialogSaveAs).Show"


--
ngarland13
------------------------------------------------------------------------
ngarland13's Profile: http://www.excelforum.com/member.php...o&userid=23713
View this thread: http://www.excelforum.com/showthread...hreadid=401212


RonaldF

Directing a Save As in VBA
 
ChDrive C
ChDir C:\Data folder

--
Ronald Ferdinandus
http://www.ro-pay.nl


"ngarland13" wrote:


Hi,

I am working on a tool, and when it opens I want it to immediatly do a
save as (I have it read only, and can get the save as to come up, but i
don't want anyone saving the tool where the save as pops up, I want it
to co to their C/Data folder).

The last line in my auto open vba code is below, and that brings up the
save as screen, but i want to direct it to go to C/Data, any help would
be appreciated.

"Application.Dialogs(xlDialogSaveAs).Show"


--
ngarland13
------------------------------------------------------------------------
ngarland13's Profile: http://www.excelforum.com/member.php...o&userid=23713
View this thread: http://www.excelforum.com/showthread...hreadid=401212



ngarland13[_2_]

Directing a Save As in VBA
 

Thanks, but I couldn't get that to work. I put in the commands yo
gave me before save as string, was that a mistake

--
ngarland1
-----------------------------------------------------------------------
ngarland13's Profile: http://www.excelforum.com/member.php...fo&userid=2371
View this thread: http://www.excelforum.com/showthread.php?threadid=40121


RonaldF

Directing a Save As in VBA
 
Sorry for my first answer, the code below will do the right thing

Sub test()

Dim vFileName As Variant

'Change directory and drive
ChDrive "C"
ChDir "C:\Data"

'Ask for the new filename
vFileName = Application.GetSaveAsFilename("", "Microsoft Excel-werkmap
(*.xls),*.xls")
If vFileName < False Then
Workbooks.Add.SaveAs Filename:=vFileName
Else
MsgBox "File hasn't been saved!!!"
End If

End Sub

--
Ronald Ferdinandus
http://www.ro-pay.nl


"ngarland13" wrote:


Hi,

I am working on a tool, and when it opens I want it to immediatly do a
save as (I have it read only, and can get the save as to come up, but i
don't want anyone saving the tool where the save as pops up, I want it
to co to their C/Data folder).

The last line in my auto open vba code is below, and that brings up the
save as screen, but i want to direct it to go to C/Data, any help would
be appreciated.

"Application.Dialogs(xlDialogSaveAs).Show"


--
ngarland13
------------------------------------------------------------------------
ngarland13's Profile: http://www.excelforum.com/member.php...o&userid=23713
View this thread: http://www.excelforum.com/showthread...hreadid=401212



Dave Peterson

Directing a Save As in VBA
 
ChDrive "C"
ChDir "C:\Data"
Application.Dialogs(xlDialogSaveAs).Show

(if you still want to use the dialog.)



ngarland13 wrote:

Hi,

I am working on a tool, and when it opens I want it to immediatly do a
save as (I have it read only, and can get the save as to come up, but i
don't want anyone saving the tool where the save as pops up, I want it
to co to their C/Data folder).

The last line in my auto open vba code is below, and that brings up the
save as screen, but i want to direct it to go to C/Data, any help would
be appreciated.

"Application.Dialogs(xlDialogSaveAs).Show"

--
ngarland13
------------------------------------------------------------------------
ngarland13's Profile: http://www.excelforum.com/member.php...o&userid=23713
View this thread: http://www.excelforum.com/showthread...hreadid=401212


--

Dave Peterson


All times are GMT +1. The time now is 10:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com