ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using VBA in Excel to Make a Folder to Save Workbooks in (https://www.excelbanter.com/excel-programming/277730-using-vba-excel-make-folder-save-workbooks.html)

Jeff Marshall[_2_]

Using VBA in Excel to Make a Folder to Save Workbooks in
 
Hi ,

I have a cell(1,1) that has the text "Sept" in it and cell(1,2) has "03" in
it.
Is there a way to make a folder in C:\My documents\Invoices, that would name
the folder "Sept-03" ?

(I would like to make a macro that I run once a month that would make this
new folder naming it the month and year so I could save invoices made out to
different companies to it)

Thanks in advance for any help offered.
Jeff Marshall x23



Ron de Bruin

Using VBA in Excel to Make a Folder to Save Workbooks in
 
Try

ChDir "C:\My documents\Invoices"
MkDir Format(Now, "mmm-yy")

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Jeff Marshall" wrote in message ...
Hi ,

I have a cell(1,1) that has the text "Sept" in it and cell(1,2) has "03" in
it.
Is there a way to make a folder in C:\My documents\Invoices, that would name
the folder "Sept-03" ?

(I would like to make a macro that I run once a month that would make this
new folder naming it the month and year so I could save invoices made out to
different companies to it)

Thanks in advance for any help offered.
Jeff Marshall x23





Ken Macksey

Using VBA in Excel to Make a Folder to Save Workbooks in
 
Hi

Or this

Private Sub CommandButton1_Click()

On Error GoTo waserror

ChDrive "C"
ChDir "C:\"
ChDir "C:\my documents\invoices\"
MkDir Cells(1, "a") & " - " & Cells(1, "b")
Exit Sub

waserror:
MsgBox ("Folder may already exist. Please check")

End Sub


HTH

Ken


"Jeff Marshall" wrote in message
...
Hi ,

I have a cell(1,1) that has the text "Sept" in it and cell(1,2) has "03"

in
it.
Is there a way to make a folder in C:\My documents\Invoices, that would

name
the folder "Sept-03" ?

(I would like to make a macro that I run once a month that would make this
new folder naming it the month and year so I could save invoices made out

to
different companies to it)

Thanks in advance for any help offered.
Jeff Marshall x23





---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003




All times are GMT +1. The time now is 06:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com