xlApp.Visible = True

regsvr32 "C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE" Here's a complete feature that exports a VB6 DataGrid or FlexGrid to Excel 16.0:

' Optional: Add formatting With xlWS.Rows(1) .Font.Bold = True .Interior.Color = RGB(200, 200, 200) End With

' Auto-fit columns xlWS.Columns.AutoFit

' Example: Export from MSFlexGrid (assuming you have one named MSFlexGrid1) With MSFlexGrid1 For i = 0 To .Rows - 1 For j = 0 To .Cols - 1 xlWS.Cells(i + 1, j + 1).Value = .TextMatrix(i, j) Next j Next i End With

' Make Excel visible (optional) xlApp.Visible = True

' Write data xlWS.Cells(1, 1).Value = "Hello from VB6" xlWS.Cells(1, 2).Value = "Using Excel 16.0"