pasar de Acces a Excel
Estoy aprendiendo a Programar en Basic y deseo saber como pasar nombres de Acces a Excel losprogramas que tengo me dicen """"error de compilacion no se ha definido el tipo definido por el usuario"""" como estoy aprendiendo no se que significa esto si alguien me puede mandar un correo explico mejor OKKKKKK
Hola, esper esto te pueda guiar
MSF es un control de gradilla.
Sub PasarAExcel(f As Form, MSF As Control)
Dim I As Integer ' Loop counters
Dim j As Integer
Dim rCount As Long ' Record count
Dim XL As Object
Dim iNro As Integer
Dim tr As Integer
Dim sNombre As String
Dim sTodo As String
Dim sText As String
f.CommonDialog1.DialogTitle = "Elija el archivo a grabar"
f.CommonDialog1.CancelError = True
f.CommonDialog1.Filter = "*.XLS"
On Error Resume Next
f.CommonDialog1.ShowSave
If Err = 0 Then
sNombre = f.CommonDialog1.FileName
Screen.MousePointer = 11 ' Change mousepointer
Set XL = CreateObject("Excel.Sheet")
tr = MSF.MaxRows
sTodo = ""
I = 0
For I = 0 To tr
If Not (MSF.RowHeight(I) = 0) Then
MSF.Row = I
For j = 1 To MSF.MaxCols
MSF.Col = j
sText = MSF.Text
If IsNumeric(sText) Then
sTodo = sTodo & CCur(sText)
Else
sTodo = sTodo & sText
End If
If j < MSF.MaxCols Then sTodo = sTodo & Chr$(9) Else sTodo = sTodo & vbCrLf
Next j
End If
Next I
Clipboard.Clear
Clipboard.SetText sTodo
XL.Application.ActiveSheet.Paste
XL.SaveAs sNombre
XL.Application.Quit
Set XL = Nothing ' Remove object variable.
Screen.MousePointer = 0 ' Restore mouse pointer.
End If
End Sub
MSF es un control de gradilla.
Sub PasarAExcel(f As Form, MSF As Control)
Dim I As Integer ' Loop counters
Dim j As Integer
Dim rCount As Long ' Record count
Dim XL As Object
Dim iNro As Integer
Dim tr As Integer
Dim sNombre As String
Dim sTodo As String
Dim sText As String
f.CommonDialog1.DialogTitle = "Elija el archivo a grabar"
f.CommonDialog1.CancelError = True
f.CommonDialog1.Filter = "*.XLS"
On Error Resume Next
f.CommonDialog1.ShowSave
If Err = 0 Then
sNombre = f.CommonDialog1.FileName
Screen.MousePointer = 11 ' Change mousepointer
Set XL = CreateObject("Excel.Sheet")
tr = MSF.MaxRows
sTodo = ""
I = 0
For I = 0 To tr
If Not (MSF.RowHeight(I) = 0) Then
MSF.Row = I
For j = 1 To MSF.MaxCols
MSF.Col = j
sText = MSF.Text
If IsNumeric(sText) Then
sTodo = sTodo & CCur(sText)
Else
sTodo = sTodo & sText
End If
If j < MSF.MaxCols Then sTodo = sTodo & Chr$(9) Else sTodo = sTodo & vbCrLf
Next j
End If
Next I
Clipboard.Clear
Clipboard.SetText sTodo
XL.Application.ActiveSheet.Paste
XL.SaveAs sNombre
XL.Application.Quit
Set XL = Nothing ' Remove object variable.
Screen.MousePointer = 0 ' Restore mouse pointer.
End If
End Sub
