1 Reply Latest reply: Jul 4, 2012 3:33 AM by Yogananthan Arjunan RSS

    Macro Issue with Windows 7 client

      As Qlikview exports data into .xls it allows only 256 characters per cell. Here we have data of more than 256 characters per cell. So that I created macro to copy from QV table and paste into .xlsx. It works fine with XP client and not works with Windows 7 client.

       

      Server O/S: Windows 2008 R2

      Client O/S : Windows XP SP3 - This macro is working fine

      Client O/S : Windows 7 - This macro throws error saying "PasteSpecial method of worksheet class failed"

       

      Macro Script:

      '----------------------------------------------------------------------------------------

      Public Sub ExportUnTruncated
      set v=ActiveDocument.Fields("Report_Name")
      If(v.GetSelectedValues.count >=1) then

        set XLApp = CreateObject("Excel.Application")
        XLApp.Visible = False
        set XLDoc = XLApp.Workbooks.Add
        set table = ActiveDocument.GetSheetObject("CH17")'Copy table and paste into Excel
        set XLSheet = XLDoc.Worksheets(1) 'get the reference to the first sheet
        XLSheet.Activate

        table.CopyTableToClipboard true
        XLSheet.Range("A1").PasteSpecial
       
        XLSheet.Range("A1").Cells.CurrentRegion.Borders.ColorIndex = 0
        XLSheet.Cells.WrapText = False 
        XLApp.Visible = True
      Else
        Msgbox("Please select Week to Export this Report")
      End If

      end sub

      '----------------------------------------------------------------------------------------

      Can you guys help me to solve this issue. Thanks in advance

       

      Regards,

      Yoga