Vba information

mattless1

Board Regular
Joined
Apr 1, 2011
Messages
102
Hi all,

I've managed to get my project nearly finished with a lot of help from this forum and i thank you all who helped.

i have one last request thou, Which is to point me in the right direction. im trying to generate vba code which does this?
when i click on the save button it asks me to choose from a drop down list of 8 names. e.g BRN,POSS,EPOS which will be folders it creates before it saves the workbook in it.....??

I am already working with this

Sub FolderSaves()

Dim saveAsFileName As String
Dim folders As Variant, i As Integer, path As String

saveAsFileName = "C:\" & Year(Date) & "\" & MonthName(Month(Date)) & "\BRN\" & Format(Date, "mm.dd.yy") & ".xlsm"

folders = Split(saveAsFileName, "\")
path = folders(0)
For i = 1 To UBound(folders) - 1
path = path & "\" & folders(i)
If Dir(path, vbDirectory) = "" Then MkDir path
Next

Application.DisplayAlerts = False

' Save File
ActiveWorkbook.SaveAs fileName:=saveAsFileName, FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False

Application.DisplayAlerts = True

' Popup Message
MsgBox "File Saved As:" & vbNewLine & saveAsFileName

End Sub

is this possible???
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Code:
Sub FolderSaves()
Dim saveAsFileName As String
Dim folders As Variant, i As Integer, path As String
Dim vDir, vFile

On Error Resume Next
vDir = "C:\" & Year(Date) & "\" & MonthName(Month(Date)) & cboBoxName
vFile = Format(Date, "mm.dd.yy") & ".xlsm"
MkDir vDir
saveAsFileName = vDir & "\" & vFile

Application.DisplayAlerts = False
   ' Save File
ActiveWorkbook.SaveAs Filename:=saveAsFileName, FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
Application.DisplayAlerts = True
  ' Popup Message
MsgBox "File Saved As:" & vbNewLine & saveAsFileName
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,229
Messages
6,170,881
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