Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Matias
 
Posts: n/a
Default Throubles with Visual Basic and Excel

Hi, i use this code to send all data in a msflexgrid to an excel worksheet:

Private Sub cmdExcel_Click()
Dim AppEx As Excel.Application
Dim AreaLibroex As Excel.Workbook
Dim AreaHojaEx As Excel.Worksheet
Dim I As Integer, J As Integer

'Darle valores a los objetos excel
Set AppEx = CreateObject("excel.application")
Set AreaLibroex = AppEx.Workbooks.Add
Set AreaHojaEx = AreaLibroex.Worksheets(1)

'Recorrer el grid y pasar los valores a cada celda de la hoja de excel
prgBar.Max = grid.Rows - 1
For I = 0 To grid.Rows - 1
prgBar.Value = I
For J = 0 To grid.Cols - 1
AreaHojaEx.Cells(I + 1, J + 1) = grid.TextMatrix(I, J)
Next
Next
prgBar.Value = 0
prgBar.Max = 100

AppEx.Visible = True

Set AppEx = Nothing
Set AreaLibroex = Nothing
Set AreaHojaEx = Nothing

End Sub

but, my throuble comes when one of the celd in the grid is a date, the
convertion is bad. For example, if the celd says "01/12/04", in excel it
appears like "12/01/04", the werid thing is that, that only happens with
dates where month day. I use the "dd/mm/yy" format.

it works like this:

msflexgrid - excel
01/12/04 - 12/01/04
02/12/04 - 12/02/04
03/12/04 - 12/03/04
....
11/12/04 - 12/11/04
12/12/04 - 12/12/04
13/12/04 - 13/12/04

this is true for all months. I tried a lot of things but nothing seems to
work... please please please help me!!

Sorry if my english is not so good, Matias.
  #2   Report Post  
Ken Macksey
 
Posts: n/a
Default

Try going into windows Control Panel, date and time and set the short date
to "dd/mm/yy"

HTH

Ken


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel version identification from Visual Basic Raja Ranga Excel Discussion (Misc queries) 6 January 17th 05 08:48 PM
Formula in Visual Basic For Excel imej-clavier Excel Discussion (Misc queries) 2 December 23rd 04 01:43 PM
Visual Basic Code Remains in "memory" Paul Moles Excel Worksheet Functions 1 December 10th 04 10:29 PM
Visual Basic Help Duncan Smith Excel Discussion (Misc queries) 1 December 3rd 04 09:13 AM
HOW CAN I GET OFFICE 2003 EXCEL BASIC TO NEST FUNCTIONS LIKE EXCE. Robert AS Excel Worksheet Functions 4 December 2nd 04 10:49 AM


All times are GMT +1. The time now is 10:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"