RE:Import/Export a Excel
Publicado por
Josema (1 intervención) el 29/11/2000 00:00:00
aqui tienes la solucion a parte de tus problemas
Private Sub Command9_Click()
Dim colu As Long
Dim rw As Long
Dim i As Long
Dim CentiRW As Long
Dim ef1 As New ExcelFile
Dim NameExcel As String
´ Establecer CancelError a True
CommonDialog1.CancelError = True
On Error GoTo ErrEXCEL
´ Establecer los indicadores
CommonDialog1.Flags = cdlOFNHideReadOnly
´ Establecer los filtros
CommonDialog1.Filter = "Todos los archivos (*.XLS)|*.XLS"
´ Especificar el filtro predeterminado
CommonDialog1.FilterIndex = 2
´ Presentar el cuadro de diálogo Abrir
CommonDialog1.ShowSave
´ Presentar el nombre del archivo seleccionado
NameExcel = CommonDialog1.FileName
´ MsgBox CommonDialog1.FileName
MousePointer = vbHourglass
With ef1
.OpenFile NameExcel
CentiRW = 0
´ METEMOS LA CABECERA DEL FICHERO
For colu = 0 To flxResults.Cols - 1
If flxResults.TextMatrix(0, colu) <> "" Then
.EWriteString 0, colu, flxResults.TextMatrix(0, colu)
Else
.EWriteString 0, colu, " "
End If
Next colu
For i = 1 To PaginasGRID
MuestraGrid (i)
For rw = 1 To flxResults.Rows - 1
CentiRW = CentiRW + 1
For colu = 0 To flxResults.Cols - 1
If flxResults.TextMatrix(rw, colu) <> "" Then
.EWriteString CentiRW, co