Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 149
Default Set initial filename before saving

When a new workbook is created from a template the proposed (initial)
filename when saving the workbook is the "template name".xls. I would like
to have this proposed name (initial name) to be equal to cell content. Would
you please help me with the coding.

Here is what I have so far:

Private Sub Worksheet_Change(ByVal Target As Range)
'
' How do I run a macro every time a certain cell changes its value?
' Event called Worksheet_Change which is triggered when a
' value is entered (it will not fire when a formula result changes).


' If Intersect(Target, Range("A2")) Is Nothing Then
' Exit Sub
' Else
' Call Set_InitialFname
' End If

End Sub
----------

Sub Set_InitialFname()
'
' Propose a preset file name when the user will save the file
'
' Set the initial file name before saving
? =Range("A2").Value & ".xls"

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 192
Default Set initial filename before saving

I think what you're looking for looks something like the following:

Sub Set_InitialFname()
'
' Propose a preset file name when the user will save the file
'
' Set the initial file name before saving
Dim initialname as String

initialname = Range("A2").Value & ".xls"

End Sub

You can then use 'initialname' in a variety of ways further along in your sub.

--
-SA


"Pierre" wrote:

When a new workbook is created from a template the proposed (initial)
filename when saving the workbook is the "template name".xls. I would like
to have this proposed name (initial name) to be equal to cell content. Would
you please help me with the coding.

Here is what I have so far:

Private Sub Worksheet_Change(ByVal Target As Range)
'
' How do I run a macro every time a certain cell changes its value?
' Event called Worksheet_Change which is triggered when a
' value is entered (it will not fire when a formula result changes).


' If Intersect(Target, Range("A2")) Is Nothing Then
' Exit Sub
' Else
' Call Set_InitialFname
' End If

End Sub
----------

Sub Set_InitialFname()
'
' Propose a preset file name when the user will save the file
'
' Set the initial file name before saving
? =Range("A2").Value & ".xls"

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 149
Default Set initial filename before saving

Thanks StumpedAgain. But it doesn't work! I've typed "Allo" in Cell A2 (so
the sub is then executed) and it doesn't change the default filename when I
click on Save or SaveAs. In the SaveAs window the Filename by default is
still the Template Name.


"StumpedAgain" wrote:

I think what you're looking for looks something like the following:

Sub Set_InitialFname()
'
' Propose a preset file name when the user will save the file
'
' Set the initial file name before saving
Dim initialname as String

initialname = Range("A2").Value & ".xls"

End Sub

You can then use 'initialname' in a variety of ways further along in your sub.

--
-SA


"Pierre" wrote:

When a new workbook is created from a template the proposed (initial)
filename when saving the workbook is the "template name".xls. I would like
to have this proposed name (initial name) to be equal to cell content. Would
you please help me with the coding.

Here is what I have so far:

Private Sub Worksheet_Change(ByVal Target As Range)
'
' How do I run a macro every time a certain cell changes its value?
' Event called Worksheet_Change which is triggered when a
' value is entered (it will not fire when a formula result changes).


' If Intersect(Target, Range("A2")) Is Nothing Then
' Exit Sub
' Else
' Call Set_InitialFname
' End If

End Sub
----------

Sub Set_InitialFname()
'
' Propose a preset file name when the user will save the file
'
' Set the initial file name before saving
? =Range("A2").Value & ".xls"

End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 192
Default Set initial filename before saving

I apologize I misunderstood your question. The following is the only way in
which I know to save using a cell reference:

ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\username\My
Documents\" & A2 & ".xls"

I am not aware of any way to change the default saveas name. Good luck!
--
-SA


"Pierre" wrote:

Thanks StumpedAgain. But it doesn't work! I've typed "Allo" in Cell A2 (so
the sub is then executed) and it doesn't change the default filename when I
click on Save or SaveAs. In the SaveAs window the Filename by default is
still the Template Name.


"StumpedAgain" wrote:

I think what you're looking for looks something like the following:

Sub Set_InitialFname()
'
' Propose a preset file name when the user will save the file
'
' Set the initial file name before saving
Dim initialname as String

initialname = Range("A2").Value & ".xls"

End Sub

You can then use 'initialname' in a variety of ways further along in your sub.

--
-SA


"Pierre" wrote:

When a new workbook is created from a template the proposed (initial)
filename when saving the workbook is the "template name".xls. I would like
to have this proposed name (initial name) to be equal to cell content. Would
you please help me with the coding.

Here is what I have so far:

Private Sub Worksheet_Change(ByVal Target As Range)
'
' How do I run a macro every time a certain cell changes its value?
' Event called Worksheet_Change which is triggered when a
' value is entered (it will not fire when a formula result changes).


' If Intersect(Target, Range("A2")) Is Nothing Then
' Exit Sub
' Else
' Call Set_InitialFname
' End If

End Sub
----------

Sub Set_InitialFname()
'
' Propose a preset file name when the user will save the file
'
' Set the initial file name before saving
? =Range("A2").Value & ".xls"

End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 149
Default Set initial filename before saving

ActiveWorkbook.SaveAs Filename doesn't work well for my need. Any voluntrer?

"StumpedAgain" wrote:

I apologize I misunderstood your question. The following is the only way in
which I know to save using a cell reference:

ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\username\My
Documents\" & A2 & ".xls"

I am not aware of any way to change the default saveas name. Good luck!
--
-SA


"Pierre" wrote:

Thanks StumpedAgain. But it doesn't work! I've typed "Allo" in Cell A2 (so
the sub is then executed) and it doesn't change the default filename when I
click on Save or SaveAs. In the SaveAs window the Filename by default is
still the Template Name.


"StumpedAgain" wrote:

I think what you're looking for looks something like the following:

Sub Set_InitialFname()
'
' Propose a preset file name when the user will save the file
'
' Set the initial file name before saving
Dim initialname as String

initialname = Range("A2").Value & ".xls"

End Sub

You can then use 'initialname' in a variety of ways further along in your sub.

--
-SA


"Pierre" wrote:

When a new workbook is created from a template the proposed (initial)
filename when saving the workbook is the "template name".xls. I would like
to have this proposed name (initial name) to be equal to cell content. Would
you please help me with the coding.

Here is what I have so far:

Private Sub Worksheet_Change(ByVal Target As Range)
'
' How do I run a macro every time a certain cell changes its value?
' Event called Worksheet_Change which is triggered when a
' value is entered (it will not fire when a formula result changes).


' If Intersect(Target, Range("A2")) Is Nothing Then
' Exit Sub
' Else
' Call Set_InitialFname
' End If

End Sub
----------

Sub Set_InitialFname()
'
' Propose a preset file name when the user will save the file
'
' Set the initial file name before saving
? =Range("A2").Value & ".xls"

End Sub

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
Saving Multiple Sheets to Another Spreadsheet Without Leaving the Initial Workbook Carroll[_2_] Excel Programming 4 June 21st 05 06:06 PM
Saving FileName Harald Staff Excel Programming 1 April 13th 05 08:50 PM
Saving with a filename already in a cell Dale Walker Excel Programming 1 November 2nd 04 05:07 PM
Saving filename same as import filename Matt Excel Programming 4 February 24th 04 03:01 PM
Saving Cell value as filename Kathy B Excel Programming 1 July 24th 03 10:59 PM


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