Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2008

Tip: Looking for answers? Try searching our database.

Filename macro and a little more?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kennected - 14 Mar 2008 18:18 GMT
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
Joel - 14 Mar 2008 18:41 GMT
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

> The following works for me:
>
[quoted text clipped - 12 lines]
>
> Can this be done
Ted McCoy - 14 Mar 2008 18:45 GMT
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

> The following works for me:
>
[quoted text clipped - 12 lines]
>
> Can this be done
Dave Peterson - 14 Mar 2008 20:53 GMT
Yesterday's response didn't work, huh?

> The following works for me:
>
[quoted text clipped - 12 lines]
>
> Can this be done

Signature

Dave Peterson

kennected - 17 Mar 2008 16:50 GMT
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.

> The following works for me:
>
[quoted text clipped - 12 lines]
>
> Can this be done
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.