<?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 Macro - Browse for file WITH default location in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Macro-Browse-for-file-WITH-default-location/m-p/1733041#M452432</link>
    <description>&lt;P&gt;I'm using the below macro so the use can pick a file to load into QlikView. I want to set a default location rather than the standard "Documents" to save the user navigating to where the file(s) are located. Is this possible? I will be using a variable based on the location of the QV document and some selections.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ub Browse_for_File
'------------------
' Get the file pathname
Set oXL=CreateObject("Excel.Application")
f_name=oXL.GetOpenFilename("All Files (*.*),*.*",,"Select file",False)
If f_name="False" then
  'user cancelled out of dialog box
  Set oXL=nothing
  Exit sub
End If
'store file pathname in the file_pathname variable
ret=ActiveDocument.GetVariable("file_pathname").SetContent(f_name,false)
Set oXL=nothin&lt;/LI-CODE&gt;&lt;P&gt;&lt;A href="http://qlikviewmaven.blogspot.com/2009/03/browse-for-file-macro-button.html" target="_blank"&gt;http://qlikviewmaven.blogspot.com/2009/03/browse-for-file-macro-button.html&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 18:16:14 GMT</pubDate>
    <dc:creator>shane_spencer</dc:creator>
    <dc:date>2024-11-16T18:16:14Z</dc:date>
    <item>
      <title>Macro - Browse for file WITH default location</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-Browse-for-file-WITH-default-location/m-p/1733041#M452432</link>
      <description>&lt;P&gt;I'm using the below macro so the use can pick a file to load into QlikView. I want to set a default location rather than the standard "Documents" to save the user navigating to where the file(s) are located. Is this possible? I will be using a variable based on the location of the QV document and some selections.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ub Browse_for_File
'------------------
' Get the file pathname
Set oXL=CreateObject("Excel.Application")
f_name=oXL.GetOpenFilename("All Files (*.*),*.*",,"Select file",False)
If f_name="False" then
  'user cancelled out of dialog box
  Set oXL=nothing
  Exit sub
End If
'store file pathname in the file_pathname variable
ret=ActiveDocument.GetVariable("file_pathname").SetContent(f_name,false)
Set oXL=nothin&lt;/LI-CODE&gt;&lt;P&gt;&lt;A href="http://qlikviewmaven.blogspot.com/2009/03/browse-for-file-macro-button.html" target="_blank"&gt;http://qlikviewmaven.blogspot.com/2009/03/browse-for-file-macro-button.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 18:16:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-Browse-for-file-WITH-default-location/m-p/1733041#M452432</guid>
      <dc:creator>shane_spencer</dc:creator>
      <dc:date>2024-11-16T18:16:14Z</dc:date>
    </item>
    <item>
      <title>Re: Macro - Browse for file WITH default location</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-Browse-for-file-WITH-default-location/m-p/1733059#M452433</link>
      <description>&lt;P&gt;After a quick search it seems that's not (so easy) possible but it looked that there are additionally and/or alternative measures available. For this take a look here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.mrexcel.com/board/threads/setting-a-default-path-in-application-getopenfilename.565906/" target="_self"&gt;https://www.mrexcel.com/board/threads/setting-a-default-path-in-application-getopenfilename.565906/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.mrexcel.com/board/threads/getopenfilename-default-directory.574110/" target="_self"&gt;https://www.mrexcel.com/board/threads/getopenfilename-default-directory.574110/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Tue, 04 Aug 2020 11:20:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-Browse-for-file-WITH-default-location/m-p/1733059#M452433</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2020-08-04T11:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: Macro - Browse for file WITH default location</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-Browse-for-file-WITH-default-location/m-p/1733080#M452435</link>
      <description>&lt;P&gt;I've already seen and tried both of them. The ChDrive and&amp;nbsp;&lt;SPAN&gt;ChDir don't appear to be valid commands in QV Macros. And the Function has an syntax problem.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Aug 2020 12:16:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-Browse-for-file-WITH-default-location/m-p/1733080#M452435</guid>
      <dc:creator>shane_spencer</dc:creator>
      <dc:date>2020-08-04T12:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: Macro - Browse for file WITH default location</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-Browse-for-file-WITH-default-location/m-p/1733102#M452438</link>
      <description>&lt;P&gt;Yes, they won't work there directly but the logic might be an option by splitting this task and outsourcing some of them (for example executing a cmd for it which writes the chosen file into any parameter/variable-file which is then already taken from the QV macro). I don't think that's a really nice way ... but probably possible ...&lt;/P&gt;&lt;P&gt;But the suggestion from the second link using the "msoFileDialogOpen" might be easier to implement.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Tue, 04 Aug 2020 12:56:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-Browse-for-file-WITH-default-location/m-p/1733102#M452438</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2020-08-04T12:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: Macro - Browse for file WITH default location</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-Browse-for-file-WITH-default-location/m-p/1733116#M452440</link>
      <description>&lt;LI-CODE lang="markup"&gt;Sub Browse_for_File
    ' Set default path
    defaultPath=ActiveDocument.GetVariable("default_path").GetContent().string
    set oXL=CreateObject("Excel.Application")
    if lcase(oXL.DefaultFilePath)&amp;lt;&amp;gt;lcase(defaultPath) then
        oXL.DefaultFilePath=defaultPath
        'Close and reopen to make the the new default path available
        oXL.Quit
        set oXL=CreateObject("Excel.Application")
    end if
    ' Get the file pathname
    f_name=oXL.GetOpenFilename("All Files (*.*),*.*",,"Select file",false)
    if lcase(f_name)="false" then
        f_name=""
    end if
    oXL.Quit
    ret=ActiveDocument.GetVariable("file_pathname").SetContent(f_name,false)
end sub&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 04 Aug 2020 13:29:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-Browse-for-file-WITH-default-location/m-p/1733116#M452440</guid>
      <dc:creator>cwolf</dc:creator>
      <dc:date>2020-08-04T13:29:25Z</dc:date>
    </item>
    <item>
      <title>Re: Macro - Browse for file WITH default location</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-Browse-for-file-WITH-default-location/m-p/1733213#M452445</link>
      <description>&lt;P&gt;Following the link of Marcus, this is also a good solution:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;sub Browse_for_File
   defaultPath=ActiveDocument.GetVariable("default_path").GetContent().string
    f_name=""
    set oXL=CreateObject("Excel.Application")
    With oXL.FileDialog(1)
        .ButtonName = "&amp;amp;Open"
        .initialFilename = defaultPath
        .Filters.Clear
        .Filters.Add "All Files (*.*)", "*.*", 1
        .Filters.Add "Excel Files (*.xlsx)", "*.xlsx", 2
        .Filters.Add "CSV Files (*.csv)", "*.csv", 3
        .Title = "Select file"
        .AllowMultiSelect = False
        If .Show = -1 Then f_name = .SelectedItems(1)
    End With 
    oXL.Quit
    ret=ActiveDocument.GetVariable("file_pathname").SetContent(f_name,false)
end sub&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 04 Aug 2020 16:18:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-Browse-for-file-WITH-default-location/m-p/1733213#M452445</guid>
      <dc:creator>cwolf</dc:creator>
      <dc:date>2020-08-04T16:18:40Z</dc:date>
    </item>
  </channel>
</rss>

