<?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 Re: Help with PasteSpecial in Macro VBScript issues required in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Help-with-PasteSpecial-in-Macro-VBScript-issues-required/m-p/1258939#M620308</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am glad that this helped you. Please mark any helpful/Correct answers, if you are satisfied with the suggestions&lt;/P&gt;&lt;P&gt;All the best,&lt;/P&gt;&lt;P&gt;Sasi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Mar 2017 20:07:39 GMT</pubDate>
    <dc:creator>sasiparupudi1</dc:creator>
    <dc:date>2017-03-23T20:07:39Z</dc:date>
    <item>
      <title>Help with PasteSpecial in Macro VBScript issues required</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-PasteSpecial-in-Macro-VBScript-issues-required/m-p/1258935#M620304</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;I'm currently working on copying and pasting straight charts from Qlikview to an Excel spreadsheet. This is automated using a macro from within Qlikview.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;Originally I was simply copying and pasting the charts via macro which worked fine but then I started coming across issues with copying and pasting data with leading zeros, the zeros were not carried over. This is most likely down to Excel interpreting these as numbers.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;A workaround I've programmed is to format the spreadsheet template as text and then copy and paste into that which in theory should keep the leading zeros as long as I paste as values from Qlikview to Excel.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;The first issue I encountered with this is the macro falls over every time it comes across a chart with no data. I thought I had gotten around this issue by placing a check to only perform the copy and paste special if the row count is greater than 0 for a particular chart.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;Oddly, this works for some of the charts but not all. Here is an example of the code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;'-- This bit activates the correct spreadsheet template and worksheet to use and then copies the data held in a particular straight chart to the clipboard. WS1 is determined by an earlier process, it's basically the name of the worksheet and that works fine.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: arial,helvetica,sans-serif;"&gt;XlApp.Workbooks(Template).activate&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt; XlApp.Worksheets(WS1).select&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt; SET v17 = ActiveDocument.Variables("vMacroChartId7")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt; var17 = v17.GetContent.STRING&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt; Doc.Fields(fname).Clear&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt; Doc.Fields(fname).SELECT Field.Item(i).Text&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt; Doc.GetApplication.WaitForIdle&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: arial,helvetica,sans-serif;"&gt; Doc.GetSheetObject(var17).CopyTableToClipBoard TRUE&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;'-- Next a check is performed to see if the chart contains rows of data&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt; &lt;SPAN style="color: #0000ff;"&gt;Set RowCount = ActiveDocument.GetSheetObject(var17)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt; ActiveDocument.Variables("vRows").SetContent RowCount.GetNoOfRows, true &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: arial,helvetica,sans-serif;"&gt; RowsChart = ActiveDocument.Variables("vRows").GetContent.STRING&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt; '--Now if there are rows of data present then the paste special is performed. xlPasteValues is set further up in my script as &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;(&lt;SPAN style="color: #0000ff;"&gt;CONST xlPasteValues = -4163&lt;/SPAN&gt;).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt; &lt;SPAN style="color: #0000ff;"&gt;If RowsChart &amp;gt; 0 then&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt; xlApp.ActiveSheet.Range("A2").Select&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt; xlApp.ActiveSheet.PasteSpecial xlPasteValues&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;Else&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: arial,helvetica,sans-serif;"&gt;End If&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 8pt;"&gt;&lt;SPAN style="color: #000000; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;I guess my question is how can I overcome this seemingly random occurrence of the macro falling over for some charts and not others?&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 8pt;"&gt;&lt;SPAN style="color: #000000; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;Can I avoid using the check for data in charts before I can copy and paste values all together?&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 8pt;"&gt;&lt;SPAN style="color: #000000; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;I'm at a loss. Any help with this would be greatly appreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 8pt;"&gt;&lt;SPAN style="color: #000000; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;Thank you reading.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px 0px 8pt;"&gt;&lt;SPAN style="color: #000000; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;Amjid&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Mar 2017 10:08:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-PasteSpecial-in-Macro-VBScript-issues-required/m-p/1258935#M620304</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-09T10:08:25Z</dc:date>
    </item>
    <item>
      <title>Re: Help with PasteSpecial in Macro VBScript issues required</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-PasteSpecial-in-Macro-VBScript-issues-required/m-p/1258936#M620305</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Set XLApp =&amp;nbsp; CreateObject("Excel.Application")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;XLApp.Visible = True&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;XlApp.Workbooks(Template).activate&lt;/P&gt;&lt;P&gt;XlApp.Worksheets(WS1).select&lt;/P&gt;&lt;P&gt;SET v17 = ActiveDocument.Variables("vMacroChartId7")&lt;/P&gt;&lt;P&gt;var17 = v17.GetContent.STRING&lt;/P&gt;&lt;P&gt;Doc.Fields(fname).Clear&lt;/P&gt;&lt;P&gt;Doc.Fields(fname).SELECT Field.Item(i).Text&lt;/P&gt;&lt;P&gt;Doc.GetApplication.WaitForIdle&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;RowCount=Doc.GetSheetObject(var17).GetNoOfRows&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If RowCount&amp;gt;0 Then&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Doc.GetSheetObject(var17).CopyTableToClipBoard TRUE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'-- Next a check is performed to see if the chart contains rows of data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ActiveDocument.Variables("vRows").SetContent RowCount, true&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'--Now if there are rows of data present then the paste special is performed. xlPasteValues is set further up in my script as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;xlApp.ActiveSheet.Range("A2").Select&lt;/P&gt;&lt;P&gt;xlApp.ActiveSheet.PasteSpecial xlPasteValues&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; End If&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;hth&lt;/P&gt;&lt;P&gt;Sas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Mar 2017 13:07:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-PasteSpecial-in-Macro-VBScript-issues-required/m-p/1258936#M620305</guid>
      <dc:creator>sasiparupudi1</dc:creator>
      <dc:date>2017-03-17T13:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: Help with PasteSpecial in Macro VBScript issues required</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-PasteSpecial-in-Macro-VBScript-issues-required/m-p/1258937#M620306</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Sasidhar. I'll give this a go in a few days when I revisit this and will let you know how I get on.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Amjid&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Mar 2017 11:54:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-PasteSpecial-in-Macro-VBScript-issues-required/m-p/1258937#M620306</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-20T11:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help with PasteSpecial in Macro VBScript issues required</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-PasteSpecial-in-Macro-VBScript-issues-required/m-p/1258938#M620307</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you again Sasidhar. This has worked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have prevented any more of my hair turning grey.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Amjid&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Mar 2017 10:29:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-PasteSpecial-in-Macro-VBScript-issues-required/m-p/1258938#M620307</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-23T10:29:41Z</dc:date>
    </item>
    <item>
      <title>Re: Help with PasteSpecial in Macro VBScript issues required</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-PasteSpecial-in-Macro-VBScript-issues-required/m-p/1258939#M620308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am glad that this helped you. Please mark any helpful/Correct answers, if you are satisfied with the suggestions&lt;/P&gt;&lt;P&gt;All the best,&lt;/P&gt;&lt;P&gt;Sasi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Mar 2017 20:07:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-PasteSpecial-in-Macro-VBScript-issues-required/m-p/1258939#M620308</guid>
      <dc:creator>sasiparupudi1</dc:creator>
      <dc:date>2017-03-23T20:07:39Z</dc:date>
    </item>
  </channel>
</rss>

