<?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: Macro to replace file format in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Macro-to-replace-file-format/m-p/787790#M1045033</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Replace&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; myFile = vFile&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; SET var = ActiveDocument.GetVariable("vFile")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; myFile = var.GetContent.String&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Nov 2014 12:19:04 GMT</pubDate>
    <dc:creator>Peter_Cammaert</dc:creator>
    <dc:date>2014-11-20T12:19:04Z</dc:date>
    <item>
      <title>Macro to replace file format</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-replace-file-format/m-p/787789#M1045032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to replace file format from xlsx to xls using macros. Since I hardly know VBA, I need help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the code I am using is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Private Sub CommandButton1_Click()&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; Dim myfile As String&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; With Application.FileDialog(msoFileDialogFolderPicker)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; .AllowMultiSelect = False&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; If .Show = -1 Then&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; folderName = .SelectedItems(1)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; End If&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; End With&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; myfile = vFile&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; Do While myfile &amp;lt;&amp;gt; ""&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; Workbooks.OpenText Filename:= myfile&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;'save as excel file&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; ActiveWorkbook.SaveAs Filename:=folderName &amp;amp; "\" &amp;amp; Replace(myfile, ".xlsx", ".xls")&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; Application.DisplayAlerts = False&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; ActiveWorkbook.Close&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; Application.DisplayAlerts = True&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; myfile = Dir&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; Loop&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;End Sub&lt;/STRONG&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;Here, vFile is the variable that contains entire file path, which is coming from a for each loop in the main script. I don't know if we can call this variable here.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Nov 2014 12:11:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-replace-file-format/m-p/787789#M1045032</guid>
      <dc:creator />
      <dc:date>2014-11-20T12:11:26Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to replace file format</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-replace-file-format/m-p/787790#M1045033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Replace&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; myFile = vFile&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; SET var = ActiveDocument.GetVariable("vFile")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; myFile = var.GetContent.String&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Nov 2014 12:19:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-replace-file-format/m-p/787790#M1045033</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2014-11-20T12:19:04Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to replace file format</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-replace-file-format/m-p/787791#M1045034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply Peter. Could you also pls explain, how to call the macro and what would be it's name?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, there comes a pop saying Macro parse failed. Any help on this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Nov 2014 12:21:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-replace-file-format/m-p/787791#M1045034</guid>
      <dc:creator />
      <dc:date>2014-11-20T12:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to replace file format</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-replace-file-format/m-p/787792#M1045035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sometimes Qlik VBA functions works without Set keyword&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;var = ActiveDocument.GetVariable("vFile")&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;myFile = var.GetContent.String&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Nov 2014 12:28:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-replace-file-format/m-p/787792#M1045035</guid>
      <dc:creator>CELAMBARASAN</dc:creator>
      <dc:date>2014-11-20T12:28:41Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to replace file format</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-replace-file-format/m-p/787793#M1045036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Macros are called by way of a QlikView concept called "Action". An action is executed whenever triggered by an Event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actions can be added to certain QV objects that are not by default click-sensitive, like a Text box or a Button. In Object Properties you'll find a tab called Actions where you can assign o,ne or more actions to be executed in sequence whenever this object is clicked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My guess is that you want to add a button to your sheet, that calls this macro when clicked. To accomplish this, do the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Add a button object and open its properties&lt;/LI&gt;&lt;LI&gt;On the General tab, change the button text into something that explains its purpose&lt;/LI&gt;&lt;LI&gt;On the Actions tab, click Add, select Action Type = External and in the list box on the right select Run Macro and click OK.&lt;/LI&gt;&lt;LI&gt;In the Macro Name-field that pops up, enter the macro text between&amp;nbsp; Private Sub and the parentheses. That's the name of the macro.&lt;/LI&gt;&lt;LI&gt;Close the dialogs and click the button to test its operation.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Nov 2014 12:31:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-replace-file-format/m-p/787793#M1045036</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2014-11-20T12:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to replace file format</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-replace-file-format/m-p/787794#M1045037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is what I typed in the Run Macro box:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Private Sub CLICK()&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Dim myfile As String &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;With Application.FileDialog(msoFileDialogFolderPicker).AllowMultiSelect = False&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If .Show = -1 Then&lt;/STRONG&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;STRONG&gt;End If&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;End With&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SET var = ActiveDocument.GetVariable("vFile")&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;myFile = var.GetContent.String&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Do While myfile &amp;lt;&amp;gt; ""&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Workbooks.OpenText Filename:= myfile&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ActiveWorkbook.SaveAs Filename:= Replace(myfile, ".xlsx", ".xls")&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Application.DisplayAlerts = False&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ActiveWorkbook.Close&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Application.DisplayAlerts = True&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Loop&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;End Sub&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the code doesn't seem to work. Nothing happens.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Nov 2014 13:24:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-replace-file-format/m-p/787794#M1045037</guid>
      <dc:creator />
      <dc:date>2014-11-20T13:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to replace file format</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-replace-file-format/m-p/787795#M1045038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The macro definition itself should go somewhere else. In the main Desktop menu, select Tools-&amp;gt;Edit Module... The macro editor will open up. Paste the macro code in the window on the right, possibly after any definitions that are already present. When you click OK, the macro will be stored and definition will be complete. From now on, you can use this piece of VBA code by simply specifying its name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now go back to your Run Macro action and just enter the macro name in the &lt;EM&gt;Macro Name&lt;/EM&gt;-field.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Nov 2014 13:33:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-replace-file-format/m-p/787795#M1045038</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2014-11-20T13:33:27Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to replace file format</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-to-replace-file-format/m-p/787796#M1045039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;Try this this may help you &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sub test&lt;/P&gt;&lt;P&gt;vFile="C:\temp\test.xlsx"&lt;/P&gt;&lt;P&gt;Set Obj_XLApp = CreateObject ("Excel.Application")&lt;/P&gt;&lt;P&gt;&amp;nbsp; Obj_XLApp.Visible = false&lt;/P&gt;&lt;P&gt;&amp;nbsp; Obj_XLApp.DisplayAlerts = false &lt;/P&gt;&lt;P&gt;&amp;nbsp; save_as_File_Name=left(vFile,len(vFile)-1)&lt;/P&gt;&lt;P&gt;&amp;nbsp; 'msgbox save_as_File_Name&lt;/P&gt;&lt;P&gt;&amp;nbsp; set Obj_XLTemplate = Obj_XLApp.Workbooks.open (vFile) &lt;/P&gt;&lt;P&gt;&amp;nbsp; Obj_XLTemplate.saveas (save_as_File_Name)&lt;/P&gt;&lt;P&gt;&amp;nbsp; Obj_XLTemplate.close&lt;/P&gt;&lt;P&gt;&amp;nbsp; call sbDeletetingAFile(vFile)&lt;/P&gt;&lt;P&gt;&amp;nbsp; Obj_XLApp.Visible = true&lt;/P&gt;&lt;P&gt;&amp;nbsp; Obj_XLApp.DisplayAlerts = true&lt;/P&gt;&lt;P&gt;set Obj_XLTemplate=nothing&lt;/P&gt;&lt;P&gt;Set Obj_XLApp = nothing&lt;/P&gt;&lt;P&gt;end sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub sbDeletetingAFile(sFile)&lt;/P&gt;&lt;P&gt;Set FSO = CreateObject("Scripting.FileSystemObject")&lt;/P&gt;&lt;P&gt;FSO.DeleteFile sFile, True&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Harsha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Nov 2014 14:31:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-to-replace-file-format/m-p/787796#M1045039</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-11-20T14:31:04Z</dc:date>
    </item>
  </channel>
</rss>

