2 Replies Latest reply: Nov 3, 2015 4:46 AM by Nilanjan Pal RSS

    Export file

      I am getting attached error while running macro, which is for exporting straight table with caption.

      Any idea why this error comes, when i export using XL icon it is exporting with no issue, also when i make any selection and try to run macro it is working fine.

      But whole data not able to export using macro , there are 81895 rows in my table.

        • Re: Export file
          balraj ahlawat

          any sample sheet?

           

          Macro code?

            • Re: Export file

              Sub ExcelExpwCaption

                  

               

                   'Create the Excel spreadsheet

                   Set excelFile = CreateObject("Excel.Application")

                   excelFile.Visible = true

                   'Create the WorkBook

                   Set WorkBook = excelFile.WorkBooks.Add

                   'Create the Sheet

                   Set Sheet = WorkBook.WorkSheets(1)

               

               

                   'Get the chart we want to export

                   Set tableToExport = ActiveDocument.GetSheetObject("TB01")

                   Set chartProperties = tableToExport.GetProperties

                   tableToExport.CopyTableToClipboard true

               

               

                   'Get the caption

                   chartCaption = tableToExport.GetCaption.Name.v

                   'MsgBox chartCaption

               

               

                   'Set the first cell with the caption

                   Sheet.Range("A1") = chartCaption

                   'Paste the rest of the chart

                   Sheet.Paste Sheet.Range("A2")

                   excelFile.Visible = true

               


                   'Cleanup

                   Set WorkBook = nothing

                   Set excelFile = nothing

              End Sub