#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 211
Default Auto Save

Hi...

I have an auto close routine which is fine. Except I need the file to name
itself from the value of cell A1 as it closes. The user has no option in
saving the file to any other name than what is in cell A1. eg. If cell A1 has
David Jones in it then the excel file will automatically save as David
Jones.xls. Also when the sheet closes I would like a message telling the user
the name of the file and also its location.

Grateful for any help...

Thanks

Gordon...
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,173
Default Auto Save

Gordon

Maybe this will give you a start

Sub Auto_Close()
Dim SfName As String
SfName = Worksheets("Sheet1").Range("A1").Value
With ThisWorkbook
.SaveAs Filename:=SfName
MsgBox "File saved as " & SfName & ".xls" & Chr(13) & _
"In location " & .Path, vbInformation + vbOKOnly
End With
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
HIS


"Gordon" wrote in message
...
Hi...

I have an auto close routine which is fine. Except I need the file to name
itself from the value of cell A1 as it closes. The user has no option in
saving the file to any other name than what is in cell A1. eg. If cell A1
has
David Jones in it then the excel file will automatically save as David
Jones.xls. Also when the sheet closes I would like a message telling the
user
the name of the file and also its location.

Grateful for any help...

Thanks

Gordon...



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 211
Default Auto Save

Nick...

How can I specify within that code that the location for the file to be
saved should be c:/windows/desktop

As the current default its picking an obscure folder that I don't want to use.

Thanks in advance.

G



"Nick Hodge" wrote:

Gordon

Maybe this will give you a start

Sub Auto_Close()
Dim SfName As String
SfName = Worksheets("Sheet1").Range("A1").Value
With ThisWorkbook
.SaveAs Filename:=SfName
MsgBox "File saved as " & SfName & ".xls" & Chr(13) & _
"In location " & .Path, vbInformation + vbOKOnly
End With
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
HIS


"Gordon" wrote in message
...
Hi...

I have an auto close routine which is fine. Except I need the file to name
itself from the value of cell A1 as it closes. The user has no option in
saving the file to any other name than what is in cell A1. eg. If cell A1
has
David Jones in it then the excel file will automatically save as David
Jones.xls. Also when the sheet closes I would like a message telling the
user
the name of the file and also its location.

Grateful for any help...

Thanks

Gordon...




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 211
Default Auto Save

Soz Nick...

I'm a dunce...I don't know how to do that...I've just crashed the whiole
thing trying. Could you resend code with alteration?

Cheers

G

"Nick Hodge" wrote:

Gordon

You could add the path to the file name and dispense with ThisWorkbook.Path

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
HIS


"Gordon" wrote in message
...
Nick...

How can I specify within that code that the location for the file to be
saved should be c:/windows/desktop

As the current default its picking an obscure folder that I don't want to
use.

Thanks in advance.

G



"Nick Hodge" wrote:

Gordon

Maybe this will give you a start

Sub Auto_Close()
Dim SfName As String
SfName = Worksheets("Sheet1").Range("A1").Value
With ThisWorkbook
.SaveAs Filename:=SfName
MsgBox "File saved as " & SfName & ".xls" & Chr(13) & _
"In location " & .Path, vbInformation + vbOKOnly
End With
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
HIS


"Gordon" wrote in message
...
Hi...

I have an auto close routine which is fine. Except I need the file to
name
itself from the value of cell A1 as it closes. The user has no option
in
saving the file to any other name than what is in cell A1. eg. If cell
A1
has
David Jones in it then the excel file will automatically save as David
Jones.xls. Also when the sheet closes I would like a message telling
the
user
the name of the file and also its location.

Grateful for any help...

Thanks

Gordon...








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,173
Default Auto Save

Gordon

Something Like

Sub Auto_Close()
Dim SfName As String
SfName = "C:\Windows\Desktop\" & Worksheets("Sheet1").Range("A1").Value &
".xls"
With ThisWorkbook
.SaveAs Filename:=SfName
MsgBox "File saved as " & SfName
End With
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
HIS


"Gordon" wrote in message
...
Soz Nick...

I'm a dunce...I don't know how to do that...I've just crashed the whiole
thing trying. Could you resend code with alteration?

Cheers

G

"Nick Hodge" wrote:

Gordon

You could add the path to the file name and dispense with
ThisWorkbook.Path

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
HIS


"Gordon" wrote in message
...
Nick...

How can I specify within that code that the location for the file to be
saved should be c:/windows/desktop

As the current default its picking an obscure folder that I don't want
to
use.

Thanks in advance.

G



"Nick Hodge" wrote:

Gordon

Maybe this will give you a start

Sub Auto_Close()
Dim SfName As String
SfName = Worksheets("Sheet1").Range("A1").Value
With ThisWorkbook
.SaveAs Filename:=SfName
MsgBox "File saved as " & SfName & ".xls" & Chr(13) & _
"In location " & .Path, vbInformation + vbOKOnly
End With
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
HIS


"Gordon" wrote in message
...
Hi...

I have an auto close routine which is fine. Except I need the file
to
name
itself from the value of cell A1 as it closes. The user has no
option
in
saving the file to any other name than what is in cell A1. eg. If
cell
A1
has
David Jones in it then the excel file will automatically save as
David
Jones.xls. Also when the sheet closes I would like a message telling
the
user
the name of the file and also its location.

Grateful for any help...

Thanks

Gordon...








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
auto save feature (not auto recovery) Dawnee Excel Discussion (Misc queries) 3 January 20th 09 09:47 PM
Excel 2007 auto-recovery / auto-save? gpurdue Setting up and Configuration of Excel 0 May 23rd 08 10:19 PM
auto save Larry Excel Discussion (Misc queries) 4 August 23rd 06 10:19 PM
How to AUTO SAVE as opposed to turning on auto recovery: EXCEL T-mo Excel Discussion (Misc queries) 1 January 12th 06 10:16 PM
Auto Excel workbook close: save= false during an auto subroutine tomwashere2 Excel Programming 10 June 16th 05 06:23 AM


All times are GMT +1. The time now is 10:37 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"