Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Automatic File Name based on cell content

I think I am almost there. The content of A1 is from C11 (text and dat
combine). I got two sheets in the workbook. Sheet 1 name is "data
sheet 2 name is "calculation". The "A1" that I need is from sheet 1
This is what I tried...


Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim CellName As String
CellName = Range("A1")
ActiveWorkbook.SaveAs Filename:="C:\Document an
Settings\Owner\Desktop\comparable\" & CellName & ".xls"
End Sub

When I pressed "save as", it saves but did not use the file name that
want and it did not go to the folder that I want it to go. Which on
is wrong on the code.

Thanks agai

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Automatic File Name based on cell content

It looks okay, but try this version

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim CellName As String
Dim FileName As String
FileName = :="C:\Document and Settings\Owner\Desktop\comparable\"
CellName = Activeworkbook.Worksheets("Sheet1").Range("A1")
ActiveWorkbook.SaveAs FilenameFileName & CellName & ".xls"
End Sub


If that fails, insert a MsgBoc FileName & CellName & ".xls" and see what you
get.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Prangk " wrote in message
...
I think I am almost there. The content of A1 is from C11 (text and date
combine). I got two sheets in the workbook. Sheet 1 name is "data"
sheet 2 name is "calculation". The "A1" that I need is from sheet 1.
This is what I tried...


Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim CellName As String
CellName = Range("A1")
ActiveWorkbook.SaveAs Filename:="C:\Document and
Settings\Owner\Desktop\comparable\" & CellName & ".xls"
End Sub

When I pressed "save as", it saves but did not use the file name that I
want and it did not go to the folder that I want it to go. Which one
is wrong on the code.

Thanks again


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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Automatic File Name based on cell content

I can't make it work. I just copied and pasted your code but nothin
happened. Almost giving up. Any last help before i stopped trying thi
automation problem

--
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
Automatic cell content deletion [email protected] Excel Discussion (Misc queries) 4 August 24th 06 08:05 AM
insert picture from file based on cel value/content Jamaican Teacher Excel Worksheet Functions 1 June 8th 06 06:27 PM
Add name by vba based on cell content christobal Excel Programming 3 April 1st 04 12:00 PM
Automatic File Name based on cell content Craig[_13_] Excel Programming 0 April 1st 04 01:53 AM
Format Row based on Cell Content SFrongillo_Lib Excel Programming 3 October 10th 03 01:48 PM


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