Jose: al ejemplo lo hace bien, pero cuando lo aplico a mi codigo lo sigue 
dejando como texto. Te paso mi codigo. Ahh utilizo office 2003.
 
Dim objXL As New Excel.ApplicationDim wbXL As New Excel.WorkbookDim wsXL As New 
Excel.WorksheetDim intRow As Integer ' counterDim intCol As Integer ' 
counterDim gridstyle As IntegerDim mivble As Doublegridstyle = 2If Not 
IsObject(objXL) Then    MsgBox "Necesita Excel para usar esta funcion", _       
vbExclamation, "Exportar a Excel"    Exit SubEnd If
 
On Error Resume Next
objXL.Visible = TrueSet wbXL = objXL.Workbooks.AddSet wsXL = 
objXL.ActiveSheetDim WorkSheetName As StringWorkSheetName = 
"Listado_Personal.xls"With wsXL    If Not WorkSheetName = "" Then        .Name 
= WorkSheetName    End IfEnd With    ' fill worksheetFor intRow = 1 To theRows  
  For intCol = 1 To TheCols        With msfPrueba            If intCol >= 5 
Then                mivble = .TextMatrix(intRow - 1, intCol - 1)                
wsXL.Cells(intRow, intCol).Value = _               CDbl(mivble) & " "           
 Else               wsXL.Cells(intRow, intCol).Value = _               
.TextMatrix(intRow - 1, intCol - 1) & " "
            End If        End With    NextNext
For intCol = 1 To TheCols    wsXL.Columns(intCol).AutoFit    
'wsXL.Columns(intCol).AutoFormat (1)    wsXL.Range("a1", 
Right(wsXL.Columns(TheCols).AddressLocal, _         1) & theRows).AutoFormat 
gridstyleNext
End Sub
Gracias....
 
Saludos
 
Carina
> Date: Fri, 18 Apr 2008 06:52:58 -0700> From: [EMAIL PROTECTED]> Subject: 
> [vbusers] flexgrid a excel> To: [email protected]> > Carina,> abajo va un 
> codigo para VB6 con Excel 2000. Copia el valor de una label a Excel y lo 
> copia con punto decimal. Si no te funciona puede que sea un problema de la 
> version de Excel q usas.> Sdos,> Jose Moreno> > 
> '===================================> Sub Main()> Dim my_variable As Double> 
> > Dim oXLApp As Excel.Application> Dim oXLBook As Excel.Workbook> Dim 
> oXLSheet As Excel.Worksheet> Load Form1> Form1.Show> my_variable = 
> Val(Form1.Label1) 'escribi un double en label1.caption> 'o saca valores de tu 
> grid> > > Set oXLApp = New Excel.Application> Set oXLBook = 
> oXLApp.Workbooks.Open(App.Path & "\excelTest.xls")> Set oXLSheet = 
> oXLBook.Worksheets(1)> oXLApp.Visible = True> oXLSheet.Cells(3, 2).Value = 
> my_variable> > 'Set oXLSheet = Nothing> 'oXLBook.Close SaveChanges:=True> 
> 'Set oXLBook = Nothing> 'oXLApp.Quit> 'Set oXLApp = Nothing> > End Sub> > > > 
> --- On Fri, 4/18/08, Carina V. Barca <[EMAIL PROTECTED]> wrote:> > > From: 
> Carina V. Barca <[EMAIL PROTECTED]>> > Subject: [vbusers] flexgrid a excel> > 
> To: "vbusers List Member" <[email protected]>> > Date: Friday, April 18, 
> 2008, 5:58 AM> > Sebastian: Muchas gracias por responder, ahora me fijo como> 
> > hacer eso.> > > > Saludos> > > > > > Date: Fri, 18 Apr 2008 05:28:19 
> -0700From:> > [EMAIL PROTECTED]: [vbusers] flexgrid a> > excelTo: 
> [email protected]> > > > > > > > Yo ahora no recuerdo como lo tengo hecho, 
> pero lo que tenes> > que hacer es indicarle a la columna, que va a ser de 
> tipo> > númerico.> > > > Sebastian Gambolati> > > > ----- Mensaje original 
> ----De: Carina V. Barca> > <[EMAIL PROTECTED]>Para: vbusers List Member> > 
> <[email protected]>Enviado: viernes 18 de abril de> > 2008, 8:35:44Asunto: 
> [vbusers] flexgrid a excel> > > > Hola a todos: hice una funcion (en VB 6) 
> que me exporta los> > datos de un flexgrid a un excel. Hasta ahi todo bien. 
> El> > problema es que cuando tengo un numero con decimales me lo> > pasa como 
> texto. YA proble de transformarlo a doble> > cdbl(dato) antes de ponerlo en 
> el excel, despues pense que> > serian la coma o el punto y le hice un replace 
> de esta> > forma cdbl(replace(",",".")) pero nada> > funciono, cuando el 
> numero es entero lo tranforma a numero> > sino me lo deja como texto.Alguien 
> tiene idea de que puede> > ser? o como solucionarlo?.Muchas gracias.... 
> Saludos> > CarinaSigue al minuto las principales noticias de tu ciudad> > MSN 
> Deportes> > > > Yahoo! EncuentrosAhora encontrar pareja es mucho más> > 
> fácil, probá el nuevo Yahoo! Encuentros.Visitá> > 
> http://yahoo.cupidovirtual.com/servlet/NewRegistration> > 
> _________________________________________________________________> > La vida 
> de los famosos al desnudo en MSN Entretenimiento> > 
> http://entretenimiento.es.msn.com/> > > 
> ____________________________________________________________________________________>
>  Be a better friend, newshound, and > know-it-all with Yahoo! Mobile. Try it 
> now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ> 
_________________________________________________________________
La vida de los famosos al desnudo en MSN Entretenimiento
http://entretenimiento.es.msn.com/

Responder a