Ive come across some code which will create a database in Access from Excel which will copy all the data from the excel spreadsheet to a table in the database. The database is created and named the same name as the excel spreadsheet, the only problem with this code is that when it spots that the database has already been created, it throws an error.

Here is the code

Sheets("Header").Select
Range("C2").Select
ActiveCell.FormulaR1C1 = _
"=MID(CELL(""filename""),SEARCH(""["",CELL(""filename""))+1, SEARCH(""]"",CELL(""filename""))-SEARCH(""["",CELL(""filename""))-1)"
filename = Range("C2").Value
Range("C2").ClearContents


    Dim dbConnectStr As String
    Dim Catalog As Object
    Dim cnt As ADODB.Connection
    Dim dbPath As String

    'Set database name here
    dbPath = "H:\maginus\Database\Reporting\Rebates\Sell Out or In Allowance\" & filename & ".mdb"
    dbConnectStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbPath & ";"

    'Create new database
    Set Catalog = CreateObject("ADOX.Catalog")
    Catalog.Create dbConnectStr
    Set Catalog = Nothing

    'Connect to database and insert a new table
    Set cnt = New ADODB.Connection
    With cnt
        .Open dbConnectStr
        .Execute "CREATE TABLE SOA ([Customer Account] text(50), " & _
                 "[Customer Name] text(150), " & _
                 "[Product Code] text(50), " & _
                 "[Product] text(50), " & _
                 "[Quantity] text(50), " & _
                 "[Claim] text(50), " & _
                 "[Date] text(50))"
    End With
    Set cnt = Nothing
Now i want to to look to see if the database has been created, if it has, run the above code to create it, if it is already there, skip the creation part and continue to the next part that enters in the required data (not shown above)

Any ideas how to get Excel to check if the database has been created in Access?

Many Thanks

Dave