Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Save as filename cell DETAILS!B2 value


I've tried searching, perhaps not long enough, for a pre-written macro
code that, when you save the file as, the filename is automatically the
value in a particular cell of a particular sheet.

I have no experience with macros, and changing the codes I HAVE found
to work for me has been of little success :(

The file is a template for invoices, and on one sheet (named DETAILS)
in cell B2 is the invoice number we enter - so when the file is saved I
want the filename to be that number!

How would I write the code, but then also save it and make sure it runs
whenever the file is open?

Any help much appreciated

Thanks
Alex


--
alex3867
------------------------------------------------------------------------
alex3867's Profile: http://www.excelforum.com/member.php...o&userid=37220
View this thread: http://www.excelforum.com/showthread...hreadid=569909

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Save as filename cell DETAILS!B2 value

Set up a variable and then use that...

---------

Dim strFileName as String

Sheets("DETAILS").Activate
strFileName = Range("B2").Text

ActiveWorkbook.SaveAs Filename:= {ENTER FILE LOCATION HERE} & strFileName &
".xls"
-----------------

This should work for you. You must note that the File location must be in "
marks and must end with a \ bfore strFileName.

HTH.

"alex3867" wrote:


I've tried searching, perhaps not long enough, for a pre-written macro
code that, when you save the file as, the filename is automatically the
value in a particular cell of a particular sheet.

I have no experience with macros, and changing the codes I HAVE found
to work for me has been of little success :(

The file is a template for invoices, and on one sheet (named DETAILS)
in cell B2 is the invoice number we enter - so when the file is saved I
want the filename to be that number!

How would I write the code, but then also save it and make sure it runs
whenever the file is open?

Any help much appreciated

Thanks
Alex


--
alex3867
------------------------------------------------------------------------
alex3867's Profile: http://www.excelforum.com/member.php...o&userid=37220
View this thread: http://www.excelforum.com/showthread...hreadid=569909


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Save as filename cell DETAILS!B2 value


Sorry but I'm slight confused:

What is a 'variable'?

And the code:
_________________________
Dim strFileName as String

Sheets("DETAILS").Activate
strFileName = Range("B2").Text

ActiveWorkbook.SaveAs Filename:= {C:\Invoice\strFileName} & strFileName
&
".xls"
_________________________

I could not get to work using VB. I honestly have no idea what I am
doing here :(

Thanks
Alex


--
alex3867
------------------------------------------------------------------------
alex3867's Profile: http://www.excelforum.com/member.php...o&userid=37220
View this thread: http://www.excelforum.com/showthread...hreadid=569909

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 I auto save details from one cell...... dim Excel Discussion (Misc queries) 2 October 10th 07 12:03 PM
Cell("filename") doesn't update to new filename when do save as. Louis Excel Worksheet Functions 2 March 22nd 07 07:27 PM
Can I get excel to auto save details from a cell into the doc nam. excelnewbie Excel Worksheet Functions 3 September 16th 05 07:35 AM
Save as .htm with filename from cell galimi Excel Discussion (Misc queries) 1 May 13th 05 04:51 AM
Excel Visual Basic - Save (As) the document as the details in a cell Stephen Pepper Excel Programming 2 October 26th 04 12:32 PM


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