Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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!
I don`t think you are evaluating the variable in the right way
Try this:
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)