Hi all,

This is my first post after being following this forum from a distance

I started a small business and after a year I decided to automate some of my annoying daily tasks. Invoicing!

Basically I create a folder in my computer (which is linked with my Sky Drive) with the same name as my client. Then I save the invoice in excel format and also a copy in pdf inside the folder. Trouble is, I have between 4 to 7 clients every day, making more than 25 folders and files to create. (some can be repeat clients, in which I dont need to create a folder just the new files)

I would love to have a macro to create a folder (if not there yet), save the excel file in that folder, create a pdf in the same folder, then auto increase the invoice number and clear the data before going to the next invoice.

I hope I could explain what I'm trying desperately to archive. The code I came up with is a mix of some of the codes I found on the net
I have attached my invoice template below.
Code is:
Sub GenerateInvoice()
    Dim strFilename, strDirname, strPathname, strDefpath As String
    On Error Resume Next ' If directory exist goto next line
    strDirname = Range("A1").Value ' New directory name

    strFilename = Range("B8").Value 'New file name
    strDefpath = "C:\Users\Cadu\SkyDrive\Brisbane_Art_Installations\Invoices\" 'Default path name
    If IsEmpty(strDirname) Then Exit Sub
    If IsEmpty(strFilename) Then Exit Sub

    MkDir strDefpath & strDirname
    strPathname = strDefpath & strDirname & "\" & strFilename 'create total string

    ActiveWorkbook.SaveAs Filename:=strPathname, _
    FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
    ReadOnlyRecommended:=False, CreateBackup:=False
    Range("G4").Value = Range("G4").Value + 1
    Range("A18:F37").ClearContents
End Sub
Thank you in advance!

Generate_Invoice.xlsm