<?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 QlikView Questionnaire - Help needed with macro VB in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/QlikView-Questionnaire-Help-needed-with-macro-VB/m-p/169680#M40399</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have a couple of alternatives, better than Macro:&lt;/P&gt;&lt;P&gt;1. You can link your User field with the Section Access USERID (or NTName) and request "Data reduction based on Section Access", and this way when the user logs in, only one user name will be available&lt;/P&gt;&lt;P&gt;2. Another option would be to use an Action and force a selection in the field, with the value derived from function OSUser(). Depending on your needs, you can trigger an action at the required time.&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 18 Mar 2011 18:26:36 GMT</pubDate>
    <dc:creator>Oleg_Troyansky</dc:creator>
    <dc:date>2011-03-18T18:26:36Z</dc:date>
    <item>
      <title>QlikView Questionnaire - Help needed with macro VB</title>
      <link>https://community.qlik.com/t5/QlikView/QlikView-Questionnaire-Help-needed-with-macro-VB/m-p/169679#M40398</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 created a useful qlikview questionnaire based on a report i found on the forum.&lt;/P&gt;&lt;P&gt;The thing is i need help with the macro script (script below, also QVW attached).&lt;/P&gt;&lt;P&gt;Currently the user has to select the name from a list box. I want this amended so that the macro script uses the variable '&lt;B&gt;username&lt;/B&gt;' which is a system generated id (&lt;B&gt;OSUser()&lt;/B&gt;). Therefore eliminating the need for the user to select their name. Does anybody know how i should amend the code below? I think the italics part needs to be configured.&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;--------------------------------------------&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Sub SubmitQuestionnaire&lt;BR /&gt;&lt;BR /&gt;Set oXL=CreateObject("Excel.Application")&lt;BR /&gt;&lt;BR /&gt;&lt;I&gt;set doc = ActiveDocument&lt;BR /&gt;set mySelection = doc.fields("User").GetSelectedValues&lt;BR /&gt;for i = 0 to mySelection.Count -1&lt;BR /&gt;strIndex = mySelection.Item(i).text&lt;BR /&gt;next&lt;BR /&gt;&lt;/I&gt;&lt;BR /&gt;&lt;BR /&gt;set DATA1 = ActiveDocument.GetApplication.GetProperties&lt;BR /&gt;VarHolder1 = now()&lt;BR /&gt;set temp = ActiveDocument.GetApplication.GetProperties&lt;BR /&gt;VarHolder2 = mid(temp.UserName,4)&lt;BR /&gt;set vCommentsToExcel = ActiveDocument.Variables("Quest1Answer")&lt;BR /&gt;VarHolder3 = vCommentsToExcel.GetContent.String&lt;BR /&gt;set vCommentsToExcel = ActiveDocument.Variables("Quest2Answer")&lt;BR /&gt;VarHolder4 = vCommentsToExcel.GetContent.String&lt;BR /&gt;set vCommentsToExcel = ActiveDocument.Variables("Quest3Answer")&lt;BR /&gt;VarHolder5 = vCommentsToExcel.GetContent.String&lt;BR /&gt;set vCommentsToExcel = ActiveDocument.Variables("vOtherFeedback")&lt;BR /&gt;VarHolder6 = vCommentsToExcel.GetContent.String&lt;BR /&gt;&lt;BR /&gt;f_name = "\\Nmh-bus01\QVDataSource\QlikView Questionnaires\Question Answers.xls"&lt;BR /&gt;'f_name = "Question Answers.xls"&lt;BR /&gt;set oWB = oXL.Workbooks.Open(f_name)&lt;BR /&gt;set oSH = oWB.Worksheets.Item(1)&lt;BR /&gt;&lt;BR /&gt;With oWB.Worksheets.Item(1).Range("a1:a1000")&lt;BR /&gt; Set c = .Find(strIndex, , , 2, 1, 2, 0)&lt;BR /&gt; If Not c Is Nothing Then&lt;BR /&gt; firstAddress = c.Address&lt;BR /&gt; Do&lt;BR /&gt; VarHolder = VarHolder + 1&lt;BR /&gt; Set c = .FindNext(c)&lt;BR /&gt; Loop While Not c Is Nothing And c.Address &amp;lt;&amp;gt; firstAddress&lt;BR /&gt; End If&lt;BR /&gt;End With&lt;BR /&gt;&lt;BR /&gt;if VarHolder = 100 then&lt;BR /&gt;msgbox("It appears you have already submitted a questionnaire. To resubmit please delete old questionnaire?")&lt;BR /&gt;oWB.Close&lt;BR /&gt;&lt;BR /&gt;set oSH = Nothing&lt;BR /&gt;set oWB = nothing&lt;BR /&gt;set oXL = nothing&lt;BR /&gt;&lt;BR /&gt;'CLEAR SELECTIONS IF QUESTIONNAIRE ALREADY SUBMITTED&lt;BR /&gt;set v = ActiveDocument.Variables("Quest1Answer")&lt;BR /&gt;v.SetContent "",true&lt;BR /&gt;set v = ActiveDocument.Variables("Quest2Answer")&lt;BR /&gt;v.SetContent "",true&lt;BR /&gt;set v = ActiveDocument.Variables("Quest3Answer")&lt;BR /&gt;v.SetContent "",true&lt;BR /&gt;set v = ActiveDocument.Variables("vOtherFeedback")&lt;BR /&gt;v.SetContent "",true&lt;BR /&gt;exit sub&lt;BR /&gt;else&lt;BR /&gt;&lt;BR /&gt;'PASTE THE VALUES INTO EXCEL SHEET SPECIFIED&lt;BR /&gt; 'username index&lt;BR /&gt; oSH.Range("A65536").End(-4162).Offset(1,0).FormulaR1C1 = strIndex&lt;BR /&gt; 'date submitted&lt;BR /&gt; oSH.Range("A65536").End(-4162).Offset(0,1).FormulaR1C1 = VarHolder1&lt;BR /&gt; 'user login&lt;BR /&gt; oSH.Range("A65536").End(-4162).Offset(0,2).FormulaR1C1 = VarHolder2&lt;BR /&gt; 'question answers 1-3&lt;BR /&gt; oSH.Range("A65536").End(-4162).Offset(0,3).FormulaR1C1 = VarHolder3&lt;BR /&gt; oSH.Range("A65536").End(-4162).Offset(0,4).FormulaR1C1 = VarHolder4&lt;BR /&gt; oSH.Range("A65536").End(-4162).Offset(0,5).FormulaR1C1 = VarHolder5&lt;BR /&gt; 'additional feedback&lt;BR /&gt; oSH.Range("A65536").End(-4162).Offset(0,6).FormulaR1C1 = VarHolder6&lt;BR /&gt;&lt;BR /&gt; If f_name="False" then&lt;BR /&gt;&lt;BR /&gt; Set oXL=nothing&lt;BR /&gt; Exit sub&lt;BR /&gt; End If&lt;BR /&gt;&lt;BR /&gt; oWB.Save&lt;BR /&gt; oWB.Close&lt;BR /&gt;&lt;BR /&gt; Set oSH=nothing&lt;BR /&gt; Set oWB=nothing&lt;BR /&gt; Set oXL=nothing&lt;BR /&gt;&lt;BR /&gt;'CLEAR SELECTIONS AFTER SUBMISSION&lt;BR /&gt;set v = ActiveDocument.Variables("Quest1Answer")&lt;BR /&gt;v.SetContent "",true&lt;BR /&gt;set v = ActiveDocument.Variables("Quest2Answer")&lt;BR /&gt;v.SetContent "",true&lt;BR /&gt;set v = ActiveDocument.Variables("Quest3Answer")&lt;BR /&gt;v.SetContent "",true&lt;BR /&gt;set v = ActiveDocument.Variables("vOtherFeedback")&lt;BR /&gt;v.SetContent "",true&lt;BR /&gt;&lt;BR /&gt;msgbox("Thank you for completing the 'March 2011 - QlikView Questionnaire. Your answers will be reflected in the next report refresh.")&lt;BR /&gt;ActiveDocument.Reload&lt;BR /&gt;ActiveDocument.ClearAll&lt;BR /&gt;end if&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;-------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Any help would be great.&lt;/P&gt;&lt;P&gt;Thanks Jason&lt;/P&gt;&lt;P&gt;[View:http://community.qlik.com/cfs-file.ashx/__key/CommunityServer.Discussions.Components.Files/11/0574.QVW.zip:550:0]&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Mar 2011 16:41:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/QlikView-Questionnaire-Help-needed-with-macro-VB/m-p/169679#M40398</guid>
      <dc:creator />
      <dc:date>2011-03-18T16:41:41Z</dc:date>
    </item>
    <item>
      <title>QlikView Questionnaire - Help needed with macro VB</title>
      <link>https://community.qlik.com/t5/QlikView/QlikView-Questionnaire-Help-needed-with-macro-VB/m-p/169680#M40399</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have a couple of alternatives, better than Macro:&lt;/P&gt;&lt;P&gt;1. You can link your User field with the Section Access USERID (or NTName) and request "Data reduction based on Section Access", and this way when the user logs in, only one user name will be available&lt;/P&gt;&lt;P&gt;2. Another option would be to use an Action and force a selection in the field, with the value derived from function OSUser(). Depending on your needs, you can trigger an action at the required time.&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Mar 2011 18:26:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/QlikView-Questionnaire-Help-needed-with-macro-VB/m-p/169680#M40399</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2011-03-18T18:26:36Z</dc:date>
    </item>
    <item>
      <title>QlikView Questionnaire - Help needed with macro VB</title>
      <link>https://community.qlik.com/t5/QlikView/QlikView-Questionnaire-Help-needed-with-macro-VB/m-p/169681#M40400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Oleg, many thanks for your solutions.&lt;/P&gt;&lt;P&gt;Would you be kind enough to show examples of how i could amend the script?&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Jason&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Mar 2011 19:26:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/QlikView-Questionnaire-Help-needed-with-macro-VB/m-p/169681#M40400</guid>
      <dc:creator />
      <dc:date>2011-03-18T19:26:25Z</dc:date>
    </item>
    <item>
      <title>QlikView Questionnaire - Help needed with macro VB</title>
      <link>https://community.qlik.com/t5/QlikView/QlikView-Questionnaire-Help-needed-with-macro-VB/m-p/169682#M40401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jason,&lt;/P&gt;&lt;P&gt;this is kinds of a long story... it's well documented, though - look at the Reference Guide, chapter "Security"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Mar 2011 19:40:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/QlikView-Questionnaire-Help-needed-with-macro-VB/m-p/169682#M40401</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2011-03-18T19:40:17Z</dc:date>
    </item>
    <item>
      <title>QlikView Questionnaire - Help needed with macro VB</title>
      <link>https://community.qlik.com/t5/QlikView/QlikView-Questionnaire-Help-needed-with-macro-VB/m-p/169683#M40402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;im not sure how your examples work but thanks anyway&lt;/P&gt;&lt;P&gt;what i need is a way to amend the script in the macro so that it uses variable 'username' rather then "user"&lt;/P&gt;&lt;P&gt;-------------&lt;/P&gt;&lt;P&gt;set doc = ActiveDocument&lt;BR /&gt;set mySelection = doc.fields("User").GetSelectedValues&lt;BR /&gt;for i = 0 to mySelection.Count -1&lt;BR /&gt;strIndex = mySelection.Item(i).text&lt;BR /&gt;next&lt;/P&gt;&lt;P&gt;---------------&lt;/P&gt;&lt;P&gt;any ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Mar 2011 19:58:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/QlikView-Questionnaire-Help-needed-with-macro-VB/m-p/169683#M40402</guid>
      <dc:creator />
      <dc:date>2011-03-18T19:58:58Z</dc:date>
    </item>
    <item>
      <title>QlikView Questionnaire - Help needed with macro VB</title>
      <link>https://community.qlik.com/t5/QlikView/QlikView-Questionnaire-Help-needed-with-macro-VB/m-p/169684#M40403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just thought id let you know that I managed to get this working by replacing the script&lt;/P&gt;&lt;P&gt;set doc = ActiveDocument&lt;BR /&gt;set mySelection = doc.fields("User").GetSelectedValues&lt;BR /&gt;for i = 0 to mySelection.Count -1&lt;BR /&gt;strIndex = mySelection.Item(i).text&lt;BR /&gt;next&lt;/P&gt;&lt;P&gt;with the following&lt;/P&gt;&lt;P style="font-weight: bold"&gt;strIndex = ActiveDocument.Variables("Username").GetContent.String&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Mar 2011 16:01:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/QlikView-Questionnaire-Help-needed-with-macro-VB/m-p/169684#M40403</guid>
      <dc:creator />
      <dc:date>2011-03-22T16:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: QlikView Questionnaire - Help needed with macro VB</title>
      <link>https://community.qlik.com/t5/QlikView/QlikView-Questionnaire-Help-needed-with-macro-VB/m-p/169685#M40404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can you attach sample application ?&lt;/P&gt;&lt;P&gt;vikas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Dec 2015 09:19:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/QlikView-Questionnaire-Help-needed-with-macro-VB/m-p/169685#M40404</guid>
      <dc:creator>vikasmahajan</dc:creator>
      <dc:date>2015-12-04T09:19:47Z</dc:date>
    </item>
  </channel>
</rss>

