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 using cell content in file name

Can someone help with code that changes the "save As" file name to
combination of the original File Name + the contents of a cell, an
saves file in same folder as the original.

E.G. Original File Name= Timesheet
Cells B1= Location
Cell C1 = Date in format 3-5-2004
Cell A1 = concatenate(B1,C1)

Fle Name will therefore "Timesheet Location 3-5-2004"

The other problem is with the date. When concatenating, how do I forma
the date to avoid it looking like "Location 38051"

Any help much appreciated

Nic

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Save as using cell content in file name

Hi Nick,
Try this code, changing cell, sheet, thisworkbook (activeworkbook) reference as appropriate.
HTH,
Mark

Sub test()
Dim sString As String
' You don't need to use a string variable as you could just use this as an argument to saveas
' Get full workbook path and name, but remove (.xls)
' Get contents of cell, but format as required
sString = Left(ThisWorkbook.FullName, Len(ThisWorkbook.FullName) - 4) & _
Format(ThisWorkbook.Worksheets("Sheet1").Range("a1 ").Value, "dd-mm-yyyy")
ThisWorkbook.SaveAs sString
End Sub


"NickMinUK " wrote:

Can someone help with code that changes the "save As" file name to a
combination of the original File Name + the contents of a cell, and
saves file in same folder as the original.

E.G. Original File Name= Timesheet
Cells B1= Location
Cell C1 = Date in format 3-5-2004
Cell A1 = concatenate(B1,C1)

Fle Name will therefore "Timesheet Location 3-5-2004"

The other problem is with the date. When concatenating, how do I format
the date to avoid it looking like "Location 38051"

Any help much appreciated

Nick


---
Message posted from http://www.ExcelForum.com/


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
need to save multi lingual content from an Excel file to a CSV fil NormaP Excel Discussion (Misc queries) 0 May 7th 10 10:49 PM
Requiring Cell Content on Save The Chad Excel Discussion (Misc queries) 1 July 3rd 08 12:06 AM
content of cell change when print file Hafsa Excel Discussion (Misc queries) 1 July 3rd 06 01:27 PM
link cell content to another file blackstar Excel Discussion (Misc queries) 2 April 4th 06 03:20 AM
how do i automaticly "save as" using a cell's content as file nam cxlough41 Excel Discussion (Misc queries) 5 January 5th 06 05:51 AM


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