Ver Mensaje Individual
  #6 (permalink)  
Antiguo 18/12/2007, 11:46
Avatar de GeoAvila
GeoAvila
Colaborador
 
Fecha de Ingreso: diciembre-2003
Ubicación: Antigua Guatemala
Mensajes: 4.032
Antigüedad: 21 años, 4 meses
Puntos: 53
Re: imprimir DataGrid

Cita:
Iniciado por Baco_ Ver Mensaje
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
temo que no resulta con el DataGrid y hay regularmente se cambia el Data Grid por el Flexgrid.. es menos laborioso..

nos vemos..
__________________
* Antes de preguntar lee las FAQ, y por favor no hagas preguntas en las FAQ
Sitio http://www.geoavila.com twitter: @GeoAvila