VB Button required to "Save as" with multiple cell references as name, current date/time

daz5853

New Member
Joined
Jan 23, 2013
Messages
5
Morning Excel and VB wizards,

I need some help, more like spoon feeding in fact.

I am trying to create a workbook that will be used to record and store appraisals on a network drive and automatically update some cells in another tracker workbook.

But before I get ahead of myself I’d like to tackle the 'save as' issue first.</SPAN>



Id like to be able to have the Submit button Save the workbook to a network location with a format like
"1-2-1 [Persons full name] [Teamleader] [Date].xlsm

Excel Example:
A1='Persons full name'</SPAN>
A2='Team Leader'</SPAN>
A3='Client/contract name'

I currently have:
I can’t find a way to take the [persons full name] from a cell reference.
scrap all of the below if it makes it easier.</SPAN>
</SPAN>


Sub Button1_Click()
'
' Button1_Click Macro
'</SPAN>
'
ActiveWorkbook.SaveAs Filename:="\\testserver\test</SPAN> booklet2" & _
Format(Now(), "mm_dd_yyyy hh mm AMPM"), FileFormat:= _
xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
End Sub</SPAN>



Regarding the second point of having the submit button update another workbook tracker for the appraisals, I will attempt this with another button until I have gotton the other function to work and then will attempt to merge them.

In a perfect world i’d like cell A3 [contract/client name] to dictate where these will be saved using some kind of IF statement as the 121’s will be saved in sub folders defined by cleint/contract name. But this is well beyond my current understanding of VBA. Don’t try to run before you can walk huh.

Any help would be greatfully recieved.</SPAN>
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Many Thanks,

I its been difficult to stitch together but ive come up with the following:

-----------------------------------
Sub Button1_Click()
'
' Button1_Click Macro

Dim SaveName As String
SaveName = ActiveSheet.Range("B6").Value
ActiveWorkbook.SaveAs Filename:="\\sharepointA" & ActiveSheet.Range("B6").Value & _
Format(Now(), "-dd_mm_yyyy hh mm AMPM"), FileFormat:= _
xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False

End Sub
---------------------------------
This now Saves the file to the sharepoint location with the format:
"[fullname]-[date&time][macro enabled workbook].xls"

My question to those who are experienced.

Say for example cell B7 has some data validation regarding what customer the person was aligned to. how could i incorporate an IF statement to decide:

IF customer X Save to \\sharepoint\customerX</SPAN>
IF Customer Y Save to \\sharepoint\customerY</SPAN></SPAN>

If this is too complex i may have to write a manual process to save the file acordingly after.
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top