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 with specific format


I need to create a Save As macro, activated by a button, that will take
some information that is already contained in specfic cells of a
workbook to create a specific file name. Here is an example of the
file name:

Smith (ABCD) BB abc 3.11.05 where...

Smith is last name contained in cell A1
ABCD is the employee ID which will need to be entered manually
BB is a project code contained in cell B2
abc is auditors initinals to be entered manually
3.11.05 is the date the file was saved


--
BigDave
------------------------------------------------------------------------
BigDave's Profile: http://www.excelforum.com/member.php...fo&userid=7741
View this thread: http://www.excelforum.com/showthread...hreadid=375742

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Save As with specific format


Hi Dave!

This macro should work for you...

Code:
--------------------
Sub saveFile()
Dim lastName, employeeID, projCode, auditorID As String
Dim saveDate, newFileName As String
'Prompt user for ID & initials...
employeeID = InputBox("Enter employee ID: ")
auditorID = InputBox("Enter Auditor initials: ")
' Get last name...
lastName = ActiveSheet.Range("A1").Value
' Get project code...
projCode = ActiveSheet.Range("B2").Value
' If all variables are present, create new file name based on variables and save it w/new name...
If employeeID < "" And auditorID < "" And lastName < "" And projCode < "" Then
saveDate = CStr(Format(Now(), "m.d.yy"))
newFileName = lastName & " (" & employeeID & ") " & projCode & " " & auditorID & " " & saveDate & ".xls"
' Save file as new file name...
ActiveWorkbook.SaveAs Filename:=newFileName, FileFormat:=xlNormal
Else
' Otherwise, data is missing for new file name so alert user...
MsgBox ("Can't save file; required data is missing.")
End If
End Sub
--------------------

Hope this helps,
theDude


--
theDude
------------------------------------------------------------------------
theDude's Profile: http://www.excelforum.com/member.php...o&userid=16550
View this thread: http://www.excelforum.com/showthread...hreadid=375742

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
Format date with specific regional format Fjord Excel Worksheet Functions 1 December 2nd 09 07:12 PM
Save File at specific Time leerem Excel Discussion (Misc queries) 0 July 15th 09 02:14 PM
Change Date Format to Specific Text Format When Copying [email protected] Excel Discussion (Misc queries) 4 December 23rd 08 03:43 PM
Save file with specific name Dr. Schwartz[_2_] Excel Discussion (Misc queries) 5 January 24th 08 03:48 PM
Save to specific location LB79 Excel Discussion (Misc queries) 2 August 25th 05 11:02 AM


All times are GMT +1. The time now is 06:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"