Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Filename macro and a little more?

The following works for me:

Sub SaveAuto()
Dim fname
Dim fpath
fpath = "C:\Documents and Settings\Ken\Desktop\"
fname = Format(Now, "MDD_hhmm")
ActiveWorkbook.SaveAs fpath & fname
End Sub

But in addition to the result of the date code, I would like the filename
result to contain a prefix using the contents of a partcular cell of the
original workbook (3 letters that represents a customer code) which would
allow us to sort the files saved by customer in the saved directory.

Can this be done
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Filename macro and a little more?

Sub SaveAuto()
Dim fname
Dim fpath
Dim Prefix
Prefix = Range("A1")
fpath = "C:\Documents and Settings\Ken\Desktop\"
fname = Format(Now, "MDD_hhmm")
ActiveWorkbook.SaveAs fpath & Prefix & fname
End Sub

"kennected" wrote:

The following works for me:

Sub SaveAuto()
Dim fname
Dim fpath
fpath = "C:\Documents and Settings\Ken\Desktop\"
fname = Format(Now, "MDD_hhmm")
ActiveWorkbook.SaveAs fpath & fname
End Sub

But in addition to the result of the date code, I would like the filename
result to contain a prefix using the contents of a partcular cell of the
original workbook (3 letters that represents a customer code) which would
allow us to sort the files saved by customer in the saved directory.

Can this be done

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Filename macro and a little more?

something like:

Sub SaveAuto()
Dim fname
Dim fpath

Dim fprefix as string
fprefix = sheets("sheetname").cells(rownumber,columnnumber). value
fpath = "C:\Documents and Settings\Ken\Desktop\"
fname = fprefix & "_" & Format(Now, "MDD_hhmm")
ActiveWorkbook.SaveAs fpath & fname
End Sub





"kennected" wrote in message
...
The following works for me:

Sub SaveAuto()
Dim fname
Dim fpath
fpath = "C:\Documents and Settings\Ken\Desktop\"
fname = Format(Now, "MDD_hhmm")
ActiveWorkbook.SaveAs fpath & fname
End Sub

But in addition to the result of the date code, I would like the filename
result to contain a prefix using the contents of a partcular cell of the
original workbook (3 letters that represents a customer code) which would
allow us to sort the files saved by customer in the saved directory.

Can this be done


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Filename macro and a little more?

Yesterday's response didn't work, huh?

kennected wrote:

The following works for me:

Sub SaveAuto()
Dim fname
Dim fpath
fpath = "C:\Documents and Settings\Ken\Desktop\"
fname = Format(Now, "MDD_hhmm")
ActiveWorkbook.SaveAs fpath & fname
End Sub

But in addition to the result of the date code, I would like the filename
result to contain a prefix using the contents of a partcular cell of the
original workbook (3 letters that represents a customer code) which would
allow us to sort the files saved by customer in the saved directory.

Can this be done


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Filename macro and a little more?

You guys are awesome! Thanks a million. Works great. I just wish I had
more time to learn some of this. It took me about 10 years to bet the basics
in formula writing down.
P.S. Sorry Dave, just figured out how to navigate the groups and hadn't
realized you had responded. Didn't get an email the way I thought I would
have.

"kennected" wrote:

The following works for me:

Sub SaveAuto()
Dim fname
Dim fpath
fpath = "C:\Documents and Settings\Ken\Desktop\"
fname = Format(Now, "MDD_hhmm")
ActiveWorkbook.SaveAs fpath & fname
End Sub

But in addition to the result of the date code, I would like the filename
result to contain a prefix using the contents of a partcular cell of the
original workbook (3 letters that represents a customer code) which would
allow us to sort the files saved by customer in the saved directory.

Can this be done

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
Change Filename in Macro Havenstar Excel Discussion (Misc queries) 3 January 16th 09 05:27 PM
Coding a filename into a macro Guerilla Excel Programming 1 April 16th 07 09:54 PM
Appending Filename in Macro okrob Excel Programming 0 January 19th 07 11:37 PM
filename in macro ynissel Excel Discussion (Misc queries) 7 June 12th 06 08:41 PM
Put Filename Variable in Macro David Excel Discussion (Misc queries) 4 December 27th 05 06:27 PM


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