<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic After Exporting to Excel by using VBScript Number format missing in Qlik Automate</title>
    <link>https://community.qlik.com/t5/Qlik-Automate/After-Exporting-to-Excel-by-using-VBScript-Number-format-missing/m-p/2140131#M2703</link>
    <description>&lt;P&gt;Hi Guys,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need a help&lt;/P&gt;
&lt;P&gt;I have added below code in my script but not working.Please any suggest me.PFA App.&lt;/P&gt;
&lt;P&gt;oSH.Range("D" &amp;amp; num_rows).NumberFormat = "0,000"&lt;/P&gt;
&lt;P&gt;oSH.Range("D" &amp;amp; num_rows).NumberFormat = "#,###"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below my script:&lt;/P&gt;
&lt;P&gt;sub exportToExcel&lt;/P&gt;
&lt;P&gt;'==============================================================&lt;BR /&gt;' File Path &amp;amp; Name&lt;/P&gt;
&lt;P&gt;Path = "E:\QlikView\New_MACRO_REPORT\"&lt;BR /&gt;FileName = "New"&lt;BR /&gt;strSaveFile = Path &amp;amp; FileName&lt;BR /&gt;'==============================================================&lt;BR /&gt;'Open Excel&lt;/P&gt;
&lt;P&gt;set oXL=CreateObject("Excel.Application") &lt;BR /&gt;oXL.visible=True &lt;BR /&gt;oXL.Workbooks.Add&lt;/P&gt;
&lt;P&gt;aSheetObj=Array("CH01","CH02","CH03") ' Chart ID's here&lt;/P&gt;
&lt;P&gt;'==============================================================&lt;BR /&gt;for i=0 to UBound(aSheetObj)&lt;BR /&gt;Set oSH = oXL.ActiveSheet&lt;BR /&gt;&lt;BR /&gt;num_rows = oSH.UsedRange.Rows.Count&lt;BR /&gt;&lt;BR /&gt;If num_rows = 1 then&lt;BR /&gt;oSH.Range("A2").Select &lt;BR /&gt;Else&lt;BR /&gt;oSH.Range("A" &amp;amp; num_rows+4).Select &lt;BR /&gt;End If&lt;BR /&gt;&lt;BR /&gt;Set obj = ActiveDocument.GetSheetObject(aSheetObj(i))&lt;BR /&gt;obj.CopyTableToClipboard True&lt;BR /&gt;oSH.Paste &lt;BR /&gt;sCaption=obj.GetCaption.Name.v&lt;BR /&gt;set obj=Nothing &lt;BR /&gt;&lt;BR /&gt;oSH.Cells.Select&lt;/P&gt;
&lt;P&gt;oSH.Columns("A").ColumnWidth = 12.17&lt;BR /&gt;oSH.Columns("B").ColumnWidth = 12.17&lt;BR /&gt;'oSH.Columns("D").ColumnWidth = 12.17&lt;BR /&gt;If num_rows = 1 then&lt;BR /&gt;oSH.Range("A" &amp;amp; num_rows).Value = sCaption&lt;BR /&gt;oSH.Range("A" &amp;amp; num_rows).Font.Bold = True&lt;BR /&gt;'MsgBox "Before Number format"&lt;BR /&gt;'oSH.Range("D" &amp;amp; num_rows).NumberFormat = "0,000" &lt;BR /&gt;'MsgBox "After Number format"&lt;BR /&gt;oSH.Range("A" &amp;amp; num_rows).Font.ColorIndex = 3&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Else&lt;BR /&gt;&lt;BR /&gt;oSH.Range("A" &amp;amp; num_rows+3).Value = sCaption&lt;BR /&gt;oSH.Range("A" &amp;amp; num_rows+3).Font.Bold = True &lt;BR /&gt;oSH.Range("A" &amp;amp; num_rows+3).Font.ColorIndex = 3 &lt;BR /&gt;oSH.Range("A" &amp;amp;num_rows+3).Interior.ColorIndex = 40&lt;BR /&gt;oSH.Range("D" &amp;amp; num_rows+3).NumberFormat = "0"&lt;BR /&gt;End If&lt;BR /&gt;'oSH.Range("D" &amp;amp; num_rows).NumberFormat = "#,##0"&lt;BR /&gt;'oXL.Selection.Columns.AutoFit&lt;/P&gt;
&lt;P&gt;next&lt;BR /&gt;'==============================================================&lt;BR /&gt;oSH.Range("A1").Select &lt;BR /&gt;oXL.Sheets("Sheet2").Delete&lt;BR /&gt;oXL.Sheets("Sheet3").Delete&lt;BR /&gt;oSH.Name = "Data"&lt;BR /&gt;&lt;BR /&gt;oXL.ActiveWorkBook.SaveAs strSaveFile &amp;amp; replace(date, "/", "-") &amp;amp; ".xlsx" &lt;BR /&gt;&lt;BR /&gt;set oSH = Nothing &lt;BR /&gt;set oXL=Nothing&lt;BR /&gt;end sub&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Nov 2023 07:21:52 GMT</pubDate>
    <dc:creator>Nagaraj6</dc:creator>
    <dc:date>2023-11-22T07:21:52Z</dc:date>
    <item>
      <title>After Exporting to Excel by using VBScript Number format missing</title>
      <link>https://community.qlik.com/t5/Qlik-Automate/After-Exporting-to-Excel-by-using-VBScript-Number-format-missing/m-p/2140131#M2703</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need a help&lt;/P&gt;
&lt;P&gt;I have added below code in my script but not working.Please any suggest me.PFA App.&lt;/P&gt;
&lt;P&gt;oSH.Range("D" &amp;amp; num_rows).NumberFormat = "0,000"&lt;/P&gt;
&lt;P&gt;oSH.Range("D" &amp;amp; num_rows).NumberFormat = "#,###"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below my script:&lt;/P&gt;
&lt;P&gt;sub exportToExcel&lt;/P&gt;
&lt;P&gt;'==============================================================&lt;BR /&gt;' File Path &amp;amp; Name&lt;/P&gt;
&lt;P&gt;Path = "E:\QlikView\New_MACRO_REPORT\"&lt;BR /&gt;FileName = "New"&lt;BR /&gt;strSaveFile = Path &amp;amp; FileName&lt;BR /&gt;'==============================================================&lt;BR /&gt;'Open Excel&lt;/P&gt;
&lt;P&gt;set oXL=CreateObject("Excel.Application") &lt;BR /&gt;oXL.visible=True &lt;BR /&gt;oXL.Workbooks.Add&lt;/P&gt;
&lt;P&gt;aSheetObj=Array("CH01","CH02","CH03") ' Chart ID's here&lt;/P&gt;
&lt;P&gt;'==============================================================&lt;BR /&gt;for i=0 to UBound(aSheetObj)&lt;BR /&gt;Set oSH = oXL.ActiveSheet&lt;BR /&gt;&lt;BR /&gt;num_rows = oSH.UsedRange.Rows.Count&lt;BR /&gt;&lt;BR /&gt;If num_rows = 1 then&lt;BR /&gt;oSH.Range("A2").Select &lt;BR /&gt;Else&lt;BR /&gt;oSH.Range("A" &amp;amp; num_rows+4).Select &lt;BR /&gt;End If&lt;BR /&gt;&lt;BR /&gt;Set obj = ActiveDocument.GetSheetObject(aSheetObj(i))&lt;BR /&gt;obj.CopyTableToClipboard True&lt;BR /&gt;oSH.Paste &lt;BR /&gt;sCaption=obj.GetCaption.Name.v&lt;BR /&gt;set obj=Nothing &lt;BR /&gt;&lt;BR /&gt;oSH.Cells.Select&lt;/P&gt;
&lt;P&gt;oSH.Columns("A").ColumnWidth = 12.17&lt;BR /&gt;oSH.Columns("B").ColumnWidth = 12.17&lt;BR /&gt;'oSH.Columns("D").ColumnWidth = 12.17&lt;BR /&gt;If num_rows = 1 then&lt;BR /&gt;oSH.Range("A" &amp;amp; num_rows).Value = sCaption&lt;BR /&gt;oSH.Range("A" &amp;amp; num_rows).Font.Bold = True&lt;BR /&gt;'MsgBox "Before Number format"&lt;BR /&gt;'oSH.Range("D" &amp;amp; num_rows).NumberFormat = "0,000" &lt;BR /&gt;'MsgBox "After Number format"&lt;BR /&gt;oSH.Range("A" &amp;amp; num_rows).Font.ColorIndex = 3&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Else&lt;BR /&gt;&lt;BR /&gt;oSH.Range("A" &amp;amp; num_rows+3).Value = sCaption&lt;BR /&gt;oSH.Range("A" &amp;amp; num_rows+3).Font.Bold = True &lt;BR /&gt;oSH.Range("A" &amp;amp; num_rows+3).Font.ColorIndex = 3 &lt;BR /&gt;oSH.Range("A" &amp;amp;num_rows+3).Interior.ColorIndex = 40&lt;BR /&gt;oSH.Range("D" &amp;amp; num_rows+3).NumberFormat = "0"&lt;BR /&gt;End If&lt;BR /&gt;'oSH.Range("D" &amp;amp; num_rows).NumberFormat = "#,##0"&lt;BR /&gt;'oXL.Selection.Columns.AutoFit&lt;/P&gt;
&lt;P&gt;next&lt;BR /&gt;'==============================================================&lt;BR /&gt;oSH.Range("A1").Select &lt;BR /&gt;oXL.Sheets("Sheet2").Delete&lt;BR /&gt;oXL.Sheets("Sheet3").Delete&lt;BR /&gt;oSH.Name = "Data"&lt;BR /&gt;&lt;BR /&gt;oXL.ActiveWorkBook.SaveAs strSaveFile &amp;amp; replace(date, "/", "-") &amp;amp; ".xlsx" &lt;BR /&gt;&lt;BR /&gt;set oSH = Nothing &lt;BR /&gt;set oXL=Nothing&lt;BR /&gt;end sub&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 07:21:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Automate/After-Exporting-to-Excel-by-using-VBScript-Number-format-missing/m-p/2140131#M2703</guid>
      <dc:creator>Nagaraj6</dc:creator>
      <dc:date>2023-11-22T07:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: After Exporting to Excel by using VBScript Number format missing</title>
      <link>https://community.qlik.com/t5/Qlik-Automate/After-Exporting-to-Excel-by-using-VBScript-Number-format-missing/m-p/2140425#M2712</link>
      <description>&lt;P&gt;Just a few hints which may be helpful:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;formatting the area before pasting the values&lt;/LI&gt;
&lt;LI&gt;use of pastespecial instead of paste&lt;/LI&gt;
&lt;LI&gt;converting the content after the paste - because if it's applied as string you couldn't format it in any way else at first it needs to become a numeric value - quite simple would be to multiply each value with 1 and format then the result&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 15:41:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Automate/After-Exporting-to-Excel-by-using-VBScript-Number-format-missing/m-p/2140425#M2712</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2023-11-22T15:41:32Z</dc:date>
    </item>
  </channel>
</rss>

