Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
ivan_will
Partner - Creator II
Partner - Creator II

Macro help!

Hi all,

Could anyone explain me why the macro below always plays ding.wav when vMacroUser = David ?

sub PlaySound

If vMacroUser = "David" Then

ActiveDocument.PlaySound "C:\WINDOWS\Media\tada.wav"

Else

ActiveDocument.PlaySound "C:\WINDOWS\Media\ding.wav"

End If

end sub



Thanks!

1 Reply
erichshiino
Partner - Master
Partner - Master

I don`t think you are evaluating the variable in the right way

Try this:

sub PlaySound

set v = ActiveDocument.Variables("vMacroUser")
if v.GetContent.String = "David"

ActiveDocument ...

for testing purposes you can include a msgbox in the middle for tests: msgbox(v.GetContent.String)

or even msgbox(ActiveDocument.Variables("vMacroUser").GetContent.String)