ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Help with getsaveasfilename (https://www.excelbanter.com/excel-discussion-misc-queries/145001-help-getsaveasfilename.html)

Jo

Help with getsaveasfilename
 
Hi
I have the following code and MyStr = todays date which I have dimmed
previously

If (fso.FolderExists("D:\Documents and Settings\All Users\Documents"))
Then
Workbooks.Open Filename:="D:\Documents and Settings\All
Users\Documents\Forms.xls"
Dim fileSaveName
fileSaveName = Application.GetSaveAsFilename(["D:\Documents and
Settings\All Users\Documents\"] & MyStr, _
fileFilter:="All Files (*.xls), *.xls")
If fileSaveName < False Then
MsgBox "Save the incident forms for this incident as " & fileSaveName
End If
ActiveSheet.SaveAs fileSaveName

However I need the user to enter the filename and then have it also attach
to the filename they have chosen what is in MyStr and I am unsure how to do
this now.

For Example the file will currently save as
D:\Documents and Settings\All Users\Documents\040607\name user calls file
when prompted

and I want it to save as
D:\Documents and Settings\All Users\Documents\040607\040607+name user calls
file.

Can anyone help please

Bob Phillips

Help with getsaveasfilename
 
Const sPath = "C:\Documents and Settings\All Users\Documents"
Dim fileSaveName
Dim iPos As Long
If (fso.FolderExists(sPath)) Then
Workbooks.Open Filename:=sPath & "Forms.xls"
fileSaveName = Application.GetSaveAsFilename(sPath & myStr, _
fileFilter:="All Files (*.xls), *.xls")
If fileSaveName < False Then
iPos = InStrRev(fileSaveName, ".")
If iPos 0 Then
fileSaveName = Left(fileSaveName, iPos - 1) & "-" &
Format(myStr, "yyyymmdd") & ".xls"
MsgBox "Save the incident forms for this incident as " &
fileSaveName
ActiveSheet.SaveAs fileSaveName
End If
End If
End If

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Jo" wrote in message
...
Hi
I have the following code and MyStr = todays date which I have dimmed
previously

If (fso.FolderExists("D:\Documents and Settings\All Users\Documents"))
Then
Workbooks.Open Filename:="D:\Documents and Settings\All
Users\Documents\Forms.xls"
Dim fileSaveName
fileSaveName = Application.GetSaveAsFilename(["D:\Documents and
Settings\All Users\Documents\"] & MyStr, _
fileFilter:="All Files (*.xls), *.xls")
If fileSaveName < False Then
MsgBox "Save the incident forms for this incident as " &
fileSaveName
End If
ActiveSheet.SaveAs fileSaveName

However I need the user to enter the filename and then have it also attach
to the filename they have chosen what is in MyStr and I am unsure how to
do
this now.

For Example the file will currently save as
D:\Documents and Settings\All Users\Documents\040607\name user calls file
when prompted

and I want it to save as
D:\Documents and Settings\All Users\Documents\040607\040607+name user
calls
file.

Can anyone help please




Jo

Help with getsaveasfilename
 
Thanks very much Bob...works a treat.

"Bob Phillips" wrote:

Const sPath = "C:\Documents and Settings\All Users\Documents"
Dim fileSaveName
Dim iPos As Long
If (fso.FolderExists(sPath)) Then
Workbooks.Open Filename:=sPath & "Forms.xls"
fileSaveName = Application.GetSaveAsFilename(sPath & myStr, _
fileFilter:="All Files (*.xls), *.xls")
If fileSaveName < False Then
iPos = InStrRev(fileSaveName, ".")
If iPos 0 Then
fileSaveName = Left(fileSaveName, iPos - 1) & "-" &
Format(myStr, "yyyymmdd") & ".xls"
MsgBox "Save the incident forms for this incident as " &
fileSaveName
ActiveSheet.SaveAs fileSaveName
End If
End If
End If

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Jo" wrote in message
...
Hi
I have the following code and MyStr = todays date which I have dimmed
previously

If (fso.FolderExists("D:\Documents and Settings\All Users\Documents"))
Then
Workbooks.Open Filename:="D:\Documents and Settings\All
Users\Documents\Forms.xls"
Dim fileSaveName
fileSaveName = Application.GetSaveAsFilename(["D:\Documents and
Settings\All Users\Documents\"] & MyStr, _
fileFilter:="All Files (*.xls), *.xls")
If fileSaveName < False Then
MsgBox "Save the incident forms for this incident as " &
fileSaveName
End If
ActiveSheet.SaveAs fileSaveName

However I need the user to enter the filename and then have it also attach
to the filename they have chosen what is in MyStr and I am unsure how to
do
this now.

For Example the file will currently save as
D:\Documents and Settings\All Users\Documents\040607\name user calls file
when prompted

and I want it to save as
D:\Documents and Settings\All Users\Documents\040607\040607+name user
calls
file.

Can anyone help please






All times are GMT +1. The time now is 08:57 AM.

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