I have the below code that extract data from my MSHFlexgrid1 to excel.
Dim xlObject As Excel.Application
Dim xlWB As Excel.Workbook
Set xlObject = New Excel.Application
'This Adds a new woorkbook, you could open the workbook from file also
Set xlWB = xlObject.Workbooks.Add
Clipboard.clear 'Clear the Clipboard
'Select Full Contents (You could also select partial content)
.Col = 0 'From first column
.Row = 0 'From first Row (header)
.ColSel = .Cols - 1 'Select all columns
.RowSel = .Rows - 1 'Select all rows
Clipboard.SetText .Clip 'Send to Clipboard
.Range("A6").Select 'Select Cell A1 (will paste from here, to different cells)
.Paste 'Paste clipboard content
xlObject.ActiveWindow.FreezePanes = True
The problem i have is that some rows don't stay aligned.
Ex: on a row, once at column 7 that normally should be past in Excel in column G, turns to be on row below and in column A.
When i look in the access dbase see if i have sort of an empty space or a tab, i don't see any..
In below picture, what's in green, should be in the yellow fields cause in the grid, they are on the same row.
would you know how i can fix this, to export each row from my MSHFlexgrid1 to respect each row in Excel?