Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Saving Spreadsheets in a Standard Format / Name

Hi

I want to be able to force a user of a spreadsheet to save it in a standard
format using two of the cells contained within the spreadsheet as the save
name. Would anyone know of a macro that I could allow the user to run to do
this?

Thanks
Robin
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 143
Default Saving Spreadsheets in a Standard Format / Name

Try this:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim nmSave As Range

Set nmSave = Sheets("Sheet1").Range("A1")

If nmSave = "" Then
MsgBox "There is no save value", vbOKOnly
Exit Sub
End If


ActiveWorkbook.SaveAs nmSave
End Sub

You will need to customize the entry points (sheet, cell, etc). Post back
if you need more help.



--
Regards,

PJ
Please rate this post using the vote buttons if it was helpful.



"Robin1979" wrote:

Hi

I want to be able to force a user of a spreadsheet to save it in a standard
format using two of the cells contained within the spreadsheet as the save
name. Would anyone know of a macro that I could allow the user to run to do
this?

Thanks
Robin

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Saving Spreadsheets in a Standard Format / Name

Hello, thanks for the reply: I have it set against a button click with the
below code but I get a compile error - I presume due to something on the
first line being incorrect with the rest of the code??
Thanks

Sub Button30_Click()
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim nmSave As Range

Set nmSave = Sheets("Home").Range("C7")

If nmSave = "" Then
MsgBox "There is no save value", vbOKOnly
Exit Sub
End If


ActiveWorkbook.SaveAs nmSave
End Sub

"PJFry" wrote:

Try this:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim nmSave As Range

Set nmSave = Sheets("Sheet1").Range("A1")

If nmSave = "" Then
MsgBox "There is no save value", vbOKOnly
Exit Sub
End If


ActiveWorkbook.SaveAs nmSave
End Sub

You will need to customize the entry points (sheet, cell, etc). Post back
if you need more help.



--
Regards,

PJ
Please rate this post using the vote buttons if it was helpful.



"Robin1979" wrote:

Hi

I want to be able to force a user of a spreadsheet to save it in a standard
format using two of the cells contained within the spreadsheet as the save
name. Would anyone know of a macro that I could allow the user to run to do
this?

Thanks
Robin

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 143
Default Saving Spreadsheets in a Standard Format / Name

Remove the:
Private Sub Workbook_BeforeClose(Cancel As Boolean)

That piece tells Excel to save the file when it is closed. The advantage to
this method is that the user does not have to do anything. They just close
Excel and the file automatically saves with the names in the cells.

--
Regards,

PJ
Please rate this post using the vote buttons if it was helpful.



"Robin1979" wrote:

Hello, thanks for the reply: I have it set against a button click with the
below code but I get a compile error - I presume due to something on the
first line being incorrect with the rest of the code??
Thanks

Sub Button30_Click()
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim nmSave As Range

Set nmSave = Sheets("Home").Range("C7")

If nmSave = "" Then
MsgBox "There is no save value", vbOKOnly
Exit Sub
End If


ActiveWorkbook.SaveAs nmSave
End Sub

"PJFry" wrote:

Try this:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim nmSave As Range

Set nmSave = Sheets("Sheet1").Range("A1")

If nmSave = "" Then
MsgBox "There is no save value", vbOKOnly
Exit Sub
End If


ActiveWorkbook.SaveAs nmSave
End Sub

You will need to customize the entry points (sheet, cell, etc). Post back
if you need more help.



--
Regards,

PJ
Please rate this post using the vote buttons if it was helpful.



"Robin1979" wrote:

Hi

I want to be able to force a user of a spreadsheet to save it in a standard
format using two of the cells contained within the spreadsheet as the save
name. Would anyone know of a macro that I could allow the user to run to do
this?

Thanks
Robin

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
Can you put a standard footer on Excel 2007 spreadsheets? Hellmut Excel Discussion (Misc queries) 10 April 8th 08 12:18 AM
Dumb question . . . saving spreadsheets willie091028 Excel Discussion (Misc queries) 5 January 17th 07 11:41 PM
Saving spreadsheets on a network Carol Excel Discussion (Misc queries) 0 October 19th 06 09:57 PM
Excel quits when saving Macro spreadsheets Shake''n''Bake Wagner Excel Discussion (Misc queries) 0 August 2nd 06 09:41 PM
Saving Excel Spreadsheets to the Web Russ of Des Moines Excel Worksheet Functions 0 May 10th 05 05:29 PM


All times are GMT +1. The time now is 11:26 AM.

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"