Ver Mensaje Individual
  #5 (permalink)  
Antiguo 16/12/2007, 09:46
Baco_
 
Fecha de Ingreso: julio-2005
Ubicación: Salamanca
Mensajes: 54
Antigüedad: 18 años, 10 meses
Puntos: 0
Re: imprimir DataGrid

MMMM... y por que no pasas tu datagrid a excel ???
y lo presentas ahi como reporte (para mi es mucho mejor asi) ....


Private Sub Command1_Click()
Dim i As Long, j As Long
Dim objExcel As Object
Dim objWorkbook As Object
On Error Resume Next ' por si se cierra Excel antes de cargar los datos
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWorkbook = objExcel.Workbooks.Add
For i = 0 To MSHFlexGrid1.Rows - 1
MSHFlexGrid1.Row = i
For j = 0 To MSHFlexGrid1.Cols - 1
MSHFlexGrid1.Col = j
objWorkbook.ActiveSheet.Cells(i + 1, j + 1).Value = MSHFlexGrid1.Text
Next
Next
objExcel.Cells.Select
objExcel.Selection.EntireColumn.AutoFit ' Ancho de columna
objExcel.Range("A1").Select
objExcel.ActiveWindow.SelectedSheets.PrintPreview ' Previsualizar informe
Set objWorkbook = Nothing
Set objExcel = Nothing

End Sub

'DEBRIAS CAMBIAR EL MSHFLEXGRID POR TU DATAGRID A VER SI TE RESULTA AHI CUENTAS


SUERTE