Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Changing default Save As name to a cell location.

How can I make the default "save as" file name that appears when the
window dialog box opens reference a cell in the worksheet where I have
its name stored.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Changing default Save As name to a cell location.

Hi gtslabs

You can use GetSaveAsFilename
I use the value of Sheets("Sheet1").Range("A1").Value

Sub Test()
Dim fname As Variant
fname = Application.GetSaveAsFilename(Sheets("Sheet1").Ran ge("A1").Value, _
fileFilter:="Excel Files (*.xls), *.xls")
If fname < False Then
ActiveWorkbook.SaveAs fname
Else
'do nothing
End If
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"gtslabs" wrote in message ups.com...
How can I make the default "save as" file name that appears when the
window dialog box opens reference a cell in the worksheet where I have
its name stored.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Changing default Save As name to a cell location.


An alternative is to trigger the Save-event, which doesn't require an extra
mouse-click which launches a sub...


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)

Dim fileName As String

'Don't do this on Save, only on SaveAs
If SaveAsUI = True Then

'Grab filename from Cell A1
fileName = ActiveSheet.Cells(1, 1).Value

'What if they forgot the extension?
If Right(fileName, 4) < ".xls" Then fileName = fileName & ".xls"

'The TextBox for the filename in the dialog
'is already highlighted (selected) so all
'you have to do is send the filename
Application.SendKeys fileName

End If

End Sub






"Ron de Bruin" schreef in bericht
...
Hi gtslabs

You can use GetSaveAsFilename
I use the value of Sheets("Sheet1").Range("A1").Value

Sub Test()
Dim fname As Variant
fname =
Application.GetSaveAsFilename(Sheets("Sheet1").Ran ge("A1").Value, _
fileFilter:="Excel Files (*.xls),
*.xls")
If fname < False Then
ActiveWorkbook.SaveAs fname
Else
'do nothing
End If
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"gtslabs" wrote in message
ups.com...
How can I make the default "save as" file name that appears when the
window dialog box opens reference a cell in the worksheet where I have
its name stored.





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Changing default Save As name to a cell location.

This is what I need thanks, but I can not get it to launch. Where would
it go? in a separate module or the worksheet code? I tried both with
no luck.

Thanks
Steven


moon wrote:
An alternative is to trigger the Save-event, which doesn't require an extra
mouse-click which launches a sub...


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)

Dim fileName As String

'Don't do this on Save, only on SaveAs
If SaveAsUI = True Then

'Grab filename from Cell A1
fileName = ActiveSheet.Cells(1, 1).Value

'What if they forgot the extension?
If Right(fileName, 4) < ".xls" Then fileName = fileName & ".xls"

'The TextBox for the filename in the dialog
'is already highlighted (selected) so all
'you have to do is send the filename
Application.SendKeys fileName

End If

End Sub






"Ron de Bruin" schreef in bericht
...
Hi gtslabs

You can use GetSaveAsFilename
I use the value of Sheets("Sheet1").Range("A1").Value

Sub Test()
Dim fname As Variant
fname =
Application.GetSaveAsFilename(Sheets("Sheet1").Ran ge("A1").Value, _
fileFilter:="Excel Files (*.xls),
*.xls")
If fname < False Then
ActiveWorkbook.SaveAs fname
Else
'do nothing
End If
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"gtslabs" wrote in message
ups.com...
How can I make the default "save as" file name that appears when the
window dialog box opens reference a cell in the worksheet where I have
its name stored.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Changing default Save As name to a cell location.


Sorry for not mentioning that.
It should be in the Workbook-code.
Double click on ThisWorkbook to end up there.



"gtslabs" schreef in bericht
ps.com...
This is what I need thanks, but I can not get it to launch. Where would
it go? in a separate module or the worksheet code? I tried both with
no luck.

Thanks
Steven


moon wrote:
An alternative is to trigger the Save-event, which doesn't require an
extra
mouse-click which launches a sub...


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)

Dim fileName As String

'Don't do this on Save, only on SaveAs
If SaveAsUI = True Then

'Grab filename from Cell A1
fileName = ActiveSheet.Cells(1, 1).Value

'What if they forgot the extension?
If Right(fileName, 4) < ".xls" Then fileName = fileName & ".xls"

'The TextBox for the filename in the dialog
'is already highlighted (selected) so all
'you have to do is send the filename
Application.SendKeys fileName

End If

End Sub






"Ron de Bruin" schreef in bericht
...
Hi gtslabs

You can use GetSaveAsFilename
I use the value of Sheets("Sheet1").Range("A1").Value

Sub Test()
Dim fname As Variant
fname =
Application.GetSaveAsFilename(Sheets("Sheet1").Ran ge("A1").Value, _
fileFilter:="Excel Files
(*.xls),
*.xls")
If fname < False Then
ActiveWorkbook.SaveAs fname
Else
'do nothing
End If
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"gtslabs" wrote in message
ups.com...
How can I make the default "save as" file name that appears when the
window dialog box opens reference a cell in the worksheet where I have
its name stored.






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
Save to a location other than default RMires Excel Discussion (Misc queries) 6 June 4th 09 02:55 PM
Macro - save to current location vs excel default location leezard Excel Discussion (Misc queries) 0 October 28th 08 03:04 PM
Changing default location of personal.xls BevFromIndy Excel Discussion (Misc queries) 7 October 9th 06 12:32 PM
Default file location keeps on changing code_master Excel Discussion (Misc queries) 1 July 4th 05 01:46 PM
Changing Default Module Location Ron Dahl[_2_] Excel Programming 1 October 1st 04 04:13 AM


All times are GMT +1. The time now is 01:47 PM.

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

About Us

"It's about Microsoft Excel"