Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Dialog Box and Save As Location

I am using the code below to display a Save as Dialog Box with the preferred
directory location. The dialog box and correct directory location appear
however the file does not save to that filename / location once the user
presses the Save button.

Any suggestions as to my error would be appreciated

'Retrieve file name to use for Save
Dim WB As Workbook
Dim SH As Worksheet
Dim Rng2 As Range
Dim Rng3 As Range
Dim aStr As String
Dim sPath As String
Dim FName As String

Set WB = ThisWorkbook
Set SH = WB.Sheets("Cash Summ")
Set Rng2 = SH.Range("A1")
Set Rng3 = SH.Range("A2")

If Not IsEmpty(Rng2.Value) Then
aStr = Rng2.Value
aStr2 = Rng3.Value
FName = aStr & aStr2
fileSaveName = Application.GetSaveAsFilename(FName)
End If
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 421
Default Dialog Box and Save As Location

Hi Monk,

The method GetSaveAsFilename returns
the user's selection; it does not save the file.

Therefore, try something like:

'=========
Public Sub Tester2()
'Retrieve file name to use for Save
Dim WB As Workbook
Dim SH As Worksheet
Dim Rng2 As Range
Dim Rng3 As Range
Dim aStr As String
Dim sPath As String
Dim FName As String
Dim fileSaveName As Variant

Set WB = ThisWorkbook
Set SH = WB.Sheets("Cash Summ")
Set Rng2 = SH.Range("A1")
Set Rng3 = SH.Range("A2")

If Not IsEmpty(Rng2.Value) Then
aStr = Rng2.Value
aStr2 = Rng3.Value
FName = aStr & aStr2
fileSaveName = Application.GetSaveAsFilename() '(FName)
End If

If Not FName = False Then
WB.SaveAs Filename:=fileSaveName, _
FileFormat:=xlWorkbookNormal
End If
End If
End Sub
'<<=========



---
Regards.
Norman


"Monk" wrote in message
...
I am using the code below to display a Save as Dialog Box with the
preferred
directory location. The dialog box and correct directory location appear
however the file does not save to that filename / location once the user
presses the Save button.

Any suggestions as to my error would be appreciated

'Retrieve file name to use for Save
Dim WB As Workbook
Dim SH As Worksheet
Dim Rng2 As Range
Dim Rng3 As Range
Dim aStr As String
Dim sPath As String
Dim FName As String

Set WB = ThisWorkbook
Set SH = WB.Sheets("Cash Summ")
Set Rng2 = SH.Range("A1")
Set Rng3 = SH.Range("A2")

If Not IsEmpty(Rng2.Value) Then
aStr = Rng2.Value
aStr2 = Rng3.Value
FName = aStr & aStr2
fileSaveName = Application.GetSaveAsFilename(FName)
End If
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Dialog Box and Save As Location

Thanks for your assistance Norman

I am now getting a RunTime Error 13 (Type Mismatch) warning with the
following line highlighted

If Not FName = False Then


"Norman Jones" wrote:

Hi Monk,

The method GetSaveAsFilename returns
the user's selection; it does not save the file.

Therefore, try something like:

'=========
Public Sub Tester2()
'Retrieve file name to use for Save
Dim WB As Workbook
Dim SH As Worksheet
Dim Rng2 As Range
Dim Rng3 As Range
Dim aStr As String
Dim sPath As String
Dim FName As String
Dim fileSaveName As Variant

Set WB = ThisWorkbook
Set SH = WB.Sheets("Cash Summ")
Set Rng2 = SH.Range("A1")
Set Rng3 = SH.Range("A2")

If Not IsEmpty(Rng2.Value) Then
aStr = Rng2.Value
aStr2 = Rng3.Value
FName = aStr & aStr2
fileSaveName = Application.GetSaveAsFilename() '(FName)
End If

If Not FName = False Then
WB.SaveAs Filename:=fileSaveName, _
FileFormat:=xlWorkbookNormal
End If
End If
End Sub
'<<=========



---
Regards.
Norman


"Monk" wrote in message
...
I am using the code below to display a Save as Dialog Box with the
preferred
directory location. The dialog box and correct directory location appear
however the file does not save to that filename / location once the user
presses the Save button.

Any suggestions as to my error would be appreciated

'Retrieve file name to use for Save
Dim WB As Workbook
Dim SH As Worksheet
Dim Rng2 As Range
Dim Rng3 As Range
Dim aStr As String
Dim sPath As String
Dim FName As String

Set WB = ThisWorkbook
Set SH = WB.Sheets("Cash Summ")
Set Rng2 = SH.Range("A1")
Set Rng3 = SH.Range("A2")

If Not IsEmpty(Rng2.Value) Then
aStr = Rng2.Value
aStr2 = Rng3.Value
FName = aStr & aStr2
fileSaveName = Application.GetSaveAsFilename(FName)
End If
End Sub


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 421
Default Dialog Box and Save As Location

Hi Monk,

Apologies! My fault!

Replace

If Not FName = False Then
WB.SaveAs Filename:=fileSaveName, _
FileFormat:=xlWorkbookNormal
End If


with:

If fileSaveName < False Then
WB.SaveAs Filename:=fileSaveName, _
FileFormat:=xlWorkbookNormal
End If



---
Regards.
Norman

"Monk" wrote in message
...
Thanks for your assistance Norman

I am now getting a RunTime Error 13 (Type Mismatch) warning with the
following line highlighted

If Not FName = False Then



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Dialog Box and Save As Location

Hi Norman

No apologies necessary. You have assisted me greatly this weekend. Works
perfectly. Thanks

"Norman Jones" wrote:

Hi Monk,

Apologies! My fault!

Replace

If Not FName = False Then
WB.SaveAs Filename:=fileSaveName, _
FileFormat:=xlWorkbookNormal
End If


with:

If fileSaveName < False Then
WB.SaveAs Filename:=fileSaveName, _
FileFormat:=xlWorkbookNormal
End If



---
Regards.
Norman

"Monk" wrote in message
...
Thanks for your assistance Norman

I am now getting a RunTime Error 13 (Type Mismatch) warning with the
following line highlighted

If Not FName = False Then



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro - save to current location vs excel default location leezard Excel Discussion (Misc queries) 0 October 28th 08 03:04 PM
Save Excel Worksheet As CSV - No Save As Dialog SQLServant Excel Programming 1 September 29th 06 12:36 PM
how to get disk icon on save button of save as dialog like 2000 RichT Excel Discussion (Misc queries) 2 March 9th 06 08:13 PM
Save File to Another Directory, but not change Users File Save location Mike Knight Excel Programming 1 May 28th 04 09:06 PM
Changing Save As Type in Save as dialog box Phill Excel Programming 2 August 22nd 03 12:38 PM


All times are GMT +1. The time now is 07:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"