Transpose excel 36511/13/2022 ![]() ![]() ' Take care of OLE object fields or array fieldsĮlseIf IsArray(recArray(iCol, iRow)) Then RecArray(iCol, iRow) = Format(recArray(iCol, iRow)) ' copying the array to an Excel worksheet ' Check the array for contents that are not valid when RecCount = UBound(recArray, 2) 1 ' 1 since 0-based array ![]() 'data to appears properly when copied to Excel 'the first dimension contains records, allowing the 'dimension contains fields and the second dimension 'Note: GetRows returns a 0-based array where the first 'EXCEL 97 or earlier: Use GetRows then copy array to Excel 'contains an OLE object field or array data such 'Note: CopyFromRecordset will fail if the recordset ' Copy the recordset to the worksheet, starting in cell A2 If Val(Mid(xlApp.Version, 1, InStr(1, xlApp.Version, ".") - 1)) > 8 Then XlWs.Cells(1, iCol).Value = rst.Fields(iCol - 1).Name ' Copy field names to the first row of the worksheet ' Display Excel and give user control of Excel's lifetime Set xlApp = CreateObject("Excel.Application") ' Create an instance of Excel and add a workbook #Transpose excel 365 code''comment the previous code and uncomment the following code. ''When using the Access 2007 Northwind database StrDB ="c:\program files\Microsoft office\office11\samples\Northwind.mdb"Ĭnt.Open "Provider=.4.0 "
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |