By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,534 Members | 1,807 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,534 IT Pros & Developers. It's quick & easy.

2 excel tables in 1 MSHFlexGrid

P: 39
Hello all!
I have a problem combining 2 tables from excel to my MSHFlexgrid. I've succeeded to show an excel table in my MSHFlexgrid using clipboard, but then I have to add a view columns from another excel table in that MSHFlexgrid. The problem is, how to add those columns in my MSHFlexgrid?
Or, is there any other way to open an excel table in MSHFlexgrid so I can add columns from another table easier?

Thank you very much for your help!


I have these codes to show an excel table:

Private Sub Command1_Click()
Set xlapp = New Excel.Application
Set xlbook = xlapp.Workbooks.Open("C:\Documents and Settings\Administrator\My Documents\VB\dummy\PC1.xls")

Clipboard.Clear
With xlapp.ActiveWorkbook.ActiveSheet
.Range("A2:H7666").Copy
End With

With MSHFlexGrid1
.Redraw = False
.Row = 1
.Col = 0
.RowSel = MSHFlexGrid1.Rows - 1
.ColSel = MSHFlexGrid1.Cols - 1
.Clip = Replace(Clipboard.GetText, vbNewLine, vbCr)
.Col = 1
.Redraw = True
End With

xlapp.DisplayAlerts = False
xlbook.Close
xlapp.Application.Quit
Set xlbook = Nothing
Set xlapp = Nothing
End Sub

NAIRDA
May 29 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.