Exportación Excel a Access. (Visual 6.0)
Estoy intentando exportar una hoja de excel a una tabla de Access en Visual 6.0
Pero me da el siguiente error.
Me da error " Variable no declarada" en acimport
************************************
Option Compare Binary
Option Explicit
Private Const E_MODULO As String = "frmImportacion"
Public mcboBEmpresa As ClsCbM
' Objeto de control del cursor de datos
Private WithEvents oCursor As ClsCur
Private Sub cmdImportar_Click()
Dim excelapp As Object
Dim objexcel As Object
Dim oAccess As Object
Set oAccess = CreateObject("Access.Application")
'oAccess.Visible = True
oAccess.OpenCurrentDatabase ("C:\Desarrol\Gestión ITV\Ges_2005.mdb")
Set excelapp = CreateObject("Excel.Application")
Set objexcel = excelapp.workbooks.open("C:\Desarrol\Gestión ITV\b.xls", ReadOnly:=True).sheets(1)
Macro1
End Sub
'------------------------------------------------------------
' Macro1
'
'------------------------------------------------------------
Function Macro1()
On Error GoTo Macro1_Err
DoCmd.TransferSpreadsheet acimport, 6, "Prueba", "C:\Desarrol\Gestión ITV\b.xls", False
Macro1_Exit:
Exit Function
Macro1_Err:
MsgBox Error$
Resume Macro1_Exit
End Function
Pero me da el siguiente error.
Me da error " Variable no declarada" en acimport
************************************
Option Compare Binary
Option Explicit
Private Const E_MODULO As String = "frmImportacion"
Public mcboBEmpresa As ClsCbM
' Objeto de control del cursor de datos
Private WithEvents oCursor As ClsCur
Private Sub cmdImportar_Click()
Dim excelapp As Object
Dim objexcel As Object
Dim oAccess As Object
Set oAccess = CreateObject("Access.Application")
'oAccess.Visible = True
oAccess.OpenCurrentDatabase ("C:\Desarrol\Gestión ITV\Ges_2005.mdb")
Set excelapp = CreateObject("Excel.Application")
Set objexcel = excelapp.workbooks.open("C:\Desarrol\Gestión ITV\b.xls", ReadOnly:=True).sheets(1)
Macro1
End Sub
'------------------------------------------------------------
' Macro1
'
'------------------------------------------------------------
Function Macro1()
On Error GoTo Macro1_Err
DoCmd.TransferSpreadsheet acimport, 6, "Prueba", "C:\Desarrol\Gestión ITV\b.xls", False
Macro1_Exit:
Exit Function
Macro1_Err:
MsgBox Error$
Resume Macro1_Exit
End Function
1 respuesta
Respuesta de kasbeel
1