<?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: Automating Excel from a Macro (using a call with optional params) in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Automating-Excel-from-a-Macro-using-a-call-with-optional-params/m-p/508669#M190124</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OpenText isn't QV it is a excel-vba method - search in vba help "OpenText-Methode" and for examples in google.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 22 Jul 2013 14:15:40 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2013-07-22T14:15:40Z</dc:date>
    <item>
      <title>Automating Excel from a Macro (using a call with optional params)</title>
      <link>https://community.qlik.com/t5/QlikView/Automating-Excel-from-a-Macro-using-a-call-with-optional-params/m-p/508668#M190123</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to automate Excel from within a macro in QlikView, but one particular command isn't working for me.&lt;/P&gt;&lt;P&gt;The following code works absolutely fine:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;' Get the Object we wish to export&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt; Set QVTable = ActiveDocument.GetSheetObject(shtObj)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Define our temporary file&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dim strFileName&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; strFileName = TempFile&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Export the data from our current QV object to the temporary file&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; QVTable.Export strFileName, "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Excel business. Create Application &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set ExcelObj = CreateObject("Excel.Application")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Open our exported sheet as a new object&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dim wb&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set wb = ExcelObj.Workbooks.Open(strFileName) &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;So I know there's no problems with my late bound calls.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;However I want to use OpenText rather than Open, as I want to tell it to expect a tab delimited file. Now OpenText has a whole bunch of optional params (according to the &lt;A href="http://msdn.microsoft.com/en-us/library/office/aa195814(v=office.11).aspx"&gt;API guide&lt;/A&gt; at least). If I call it with the optionals removed as follows:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set wb = ExcelObj.Workbooks.OpenText(strFileName) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;this line causes the macro to fail. I've tried calling it with the required parameters supplied in the correct order(obviously substituting constants for real values):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt; Set wb = ExcelObj.Workbooks.OpenText(strFileName,1,1,1,-4142,False, True )&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;which also fails.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Anybody have any ideas how to get this working?&lt;/SPAN&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jul 2013 13:47:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Automating-Excel-from-a-Macro-using-a-call-with-optional-params/m-p/508668#M190123</guid>
      <dc:creator>justin_morley</dc:creator>
      <dc:date>2013-07-22T13:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: Automating Excel from a Macro (using a call with optional params)</title>
      <link>https://community.qlik.com/t5/QlikView/Automating-Excel-from-a-Macro-using-a-call-with-optional-params/m-p/508669#M190124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OpenText isn't QV it is a excel-vba method - search in vba help "OpenText-Methode" and for examples in google.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jul 2013 14:15:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Automating-Excel-from-a-Macro-using-a-call-with-optional-params/m-p/508669#M190124</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2013-07-22T14:15:40Z</dc:date>
    </item>
    <item>
      <title>Re: Automating Excel from a Macro (using a call with optional params)</title>
      <link>https://community.qlik.com/t5/QlikView/Automating-Excel-from-a-Macro-using-a-call-with-optional-params/m-p/508670#M190125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply. I do know that - hence the link to the Excel VBA API documentation in my post. I really wanted to get to the bottom of if there is a special format for calling optional params using QlikView's flavour of VBScript, or whether it's just the same as doing it from any other language&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A little further investigation reveals that OpenText doesn't have a return type which probably explains my problem. I'll carry on experimenting for now&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jul 2013 14:22:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Automating-Excel-from-a-Macro-using-a-call-with-optional-params/m-p/508670#M190125</guid>
      <dc:creator>justin_morley</dc:creator>
      <dc:date>2013-07-22T14:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: Automating Excel from a Macro (using a call with optional params)</title>
      <link>https://community.qlik.com/t5/QlikView/Automating-Excel-from-a-Macro-using-a-call-with-optional-params/m-p/508671#M190126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What do you want to achieve with opentext instead only open, what are the advantages?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jul 2013 14:52:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Automating-Excel-from-a-Macro-using-a-call-with-optional-params/m-p/508671#M190126</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2013-07-22T14:52:43Z</dc:date>
    </item>
    <item>
      <title>Re: Automating Excel from a Macro (using a call with optional params)</title>
      <link>https://community.qlik.com/t5/QlikView/Automating-Excel-from-a-Macro-using-a-call-with-optional-params/m-p/508672#M190127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marcus,&lt;/P&gt;&lt;P&gt;The advantage of OpenText, is you control how Excel perceives the in-coming document.&lt;/P&gt;&lt;P&gt;If I use Open I occasionally see this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Cell Header 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; | Cell Header 2&amp;nbsp;&amp;nbsp; | Cell Header 3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Cell Contents 1Cell Contents 2 | Cell Contents 3 |&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where it randomly strips out the tabs and merges cells together, which is obviously very undesirable indeed. &lt;/P&gt;&lt;P&gt;OpenText seems not to do this in my testing so far. It also seems to be working without parameters so I think I've answered my own question!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Justin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jul 2013 09:24:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Automating-Excel-from-a-Macro-using-a-call-with-optional-params/m-p/508672#M190127</guid>
      <dc:creator>justin_morley</dc:creator>
      <dc:date>2013-07-26T09:24:24Z</dc:date>
    </item>
  </channel>
</rss>

