You could open the Excel file using ADO select the data using a standard SQL 
select and display it manually in the grid......
Dim objSynD      As ADODB.Connection
Dim oRsSynD      As ADODB.Recordset

    '--- create the connection to Excel File
    '--- notice for the "Extended Property"
    '--- for Excel 97/2000/2002 use Excel 8.0
    '--- for Excel 95 use Excel 5.0
    Set objSynD = New ADODB.Connection
    objSynD.Provider = "Microsoft.Jet.OLEDB.4.0"

    objSynD.ConnectionString = _
        "Data Source= " & s & _
        ";Extended Properties=""Excel 8.0;HDR=Yes"";"         
    objSynD.CursorLocation = adUseClient
    objSynD.Open
    
    Set oRsSynD = New ADODB.Recordset
    oRsSynD.Open "SELECT * FROM [Syndicate$]", objSynD, adOpenDynamic, 
adLockOptimistic

Note:  Change the HDR=Yes to HDR=No if your excel file doesn't have column 
headers BUT it's MUCH easier to put in the headers because then you get all the 
columns returned - empty cells then are Null, without headers you can get 
different numbers of values per row.
Note also the [Syndicate$] which is the Excel sheet name - the $ has to be 
there.

Ian



  ----- Original Message ----- 
  From: shibirwol 
  To: [email protected] 
  Sent: Monday, May 09, 2005 1:36 AM
  Subject: [vbhelp] Re:how to display excel in MSFlexgrid?


  I have got problems in Vb. I am doing a project to compare 2 different 
  files. But i have to display each file in MSFlexgrid. the first 
  software is Cadstar. The second is Excel. I already displayed the 
  cadstar files in flexgrid but not from excel. Anyone can help
  ?i am really stuck and confused.thx







  '// =======================================================
      Rules : http://ReliableAnswers.com/List/Rules.asp
      Home  : http://groups.yahoo.com/group/vbHelp/
      =======================================================
      Post  : [email protected]
      Join  : [EMAIL PROTECTED]
      Leave : [EMAIL PROTECTED]
  '// =======================================================




------------------------------------------------------------------------------
  Yahoo! Groups Links

    a.. To visit your group on the web, go to:
    http://groups.yahoo.com/group/vbhelp/
      
    b.. To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]
      
    c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 



[Non-text portions of this message have been removed]




'// =======================================================
    Rules : http://ReliableAnswers.com/List/Rules.asp
    Home  : http://groups.yahoo.com/group/vbHelp/
    =======================================================
    Post  : [email protected]
    Join  : [EMAIL PROTECTED]
    Leave : [EMAIL PROTECTED]
'// =======================================================
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/vbhelp/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to