LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Naming Workbook

Hi All,

I have created a macro that saves a new workbook with a specifically defined
name. Now I have been asked to make it available for 10 individual clients
and I dont want too have 10 different client workbooks to update when
required. The process is the same for all clients.

Client clicks command button to create a CSV file and then displays the
FileSaveAs dialog with the defined file name.

The code is as follows

Sub SaveCSV()
Dim fname As Variant
Dim Filesavename As Variant
Dim ws As Worksheet
Set ws = Worksheets("Trans Types & Sources")

fname = "XXAR_INVOICES_102_DCA_WORKCOMP_" & Format(Range ("G4").Value,
"yyyy_mm_dd_" & Format(Now, "hh-mm-ss"))
Filesavename = Application.GetSaveAsFilename(InitialFileName:=fna me, _
FileFilter:="CSV Files, *.csv")

If Filesavename = False Then
ActiveWorkbook.Close savechanges:=False
Worksheets("Main").Select
Application.ScreenUpdating = True
Range("D17").Select
MsgBox "Process Cancelled at your request and no invoice data has
been lost", vbYes, "Warning"
Else
'Saves created csv file to directory for emailing
ActiveWorkbook.SaveAs Filename:=Filesavename, FileFormat:=xlCSV

Call EmailCSV
Call CanFile
Call DelRecords
Range("D17").Select
MsgBox "CSV file created saved and emailed", vbYes,
"Completed"

End If
End Sub

This works now but I need to change it to accommodate all clients with a
specific file name for each client.

This is what I am trying to do but in words.

The active sheet is XXAR_INVOICES_102_
Use the value in active sheet cell B4 to
Lookup the value in sheet Trans Types & Sources in column C and then
Take value from Column I on the same row (3 digit Alpha Code) then
Add to file name to be saved

The xxxxxs show where the value is required to be added to file name

fname = "XXAR_INVOICES_102_" & XXXXX & "WORKCOMP_" _
& Format(Range("G4").Value, "yyyy_mm_dd_" & Format(Now, "hh-mm-ss")
)

I hope you can understand what is needed. Many thanks for the help

ViViC

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200712/1

 
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
Naming a workbook WITHOUT saving it? Tom Ogilvy Excel Programming 1 March 21st 06 06:40 PM
Naming new workbook PraxisPete Excel Programming 2 May 6th 05 03:33 PM
Workbook naming Jenny Excel Programming 2 September 2nd 04 04:47 PM
Workbook naming Jenny Excel Programming 1 September 2nd 04 03:36 PM
Workbook naming Jenny Excel Programming 1 September 2nd 04 03:16 PM


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"