Very frustrated. I have set this up already in Excel to go to Access but it seems like when I ask questions here I get told to do things in Access but nothing seems to work!
I want to open an Excel File then Save that Excel file under a new name.
From there I want to export (I'm now working in Access) data to the new Excel workbook.
I am getting nowhere
This gives me a 'unrecognizable database' format error.
Is this worth my time? I am not a programmer by trade and if this requires one to be a programmer I have to go back to Excel.
(It seems I have to specify something somewhere but I can not find any exmples - tons exist for programming in Excel)
Private Sub cmdOpenExcelTemplate_Click()
Dim strFullPath As String
Dim sXL_Path As String
Dim XL As Excel.Application
Dim Excel As Excel.Workbook
Dim Objcat As New ADOX.Catalog
Dim oXLConn As New ADODB.Connection
' Get the Path Name
strFullPath = CurrentDb().Name
sXL_Path = Left(strFullPath, InStrRev(strFullPath, "\")) & TargetXLFile
MsgBox (sXL_Path)
With oXLConn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = sXL_Path
.Open
End With
oXLConn.Close
Set Objcat = Nothing
Set oXLConn = Nothing
End Sub
-----------------------------------------
I can get it to open the Excel file (not using ADO) but not open and connect to it.
I want to open an Excel File then Save that Excel file under a new name.
From there I want to export (I'm now working in Access) data to the new Excel workbook.
I am getting nowhere
This gives me a 'unrecognizable database' format error.
Is this worth my time? I am not a programmer by trade and if this requires one to be a programmer I have to go back to Excel.
(It seems I have to specify something somewhere but I can not find any exmples - tons exist for programming in Excel)
Private Sub cmdOpenExcelTemplate_Click()
Dim strFullPath As String
Dim sXL_Path As String
Dim XL As Excel.Application
Dim Excel As Excel.Workbook
Dim Objcat As New ADOX.Catalog
Dim oXLConn As New ADODB.Connection
' Get the Path Name
strFullPath = CurrentDb().Name
sXL_Path = Left(strFullPath, InStrRev(strFullPath, "\")) & TargetXLFile
MsgBox (sXL_Path)
With oXLConn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = sXL_Path
.Open
End With
oXLConn.Close
Set Objcat = Nothing
Set oXLConn = Nothing
End Sub
-----------------------------------------
I can get it to open the Excel file (not using ADO) but not open and connect to it.
Last edited: