WebPageOptions.SetBackgroundSoundRepeat method (Publisher)

Specifies whether the background sound attached to a webpage should be played infinitely after the page is loaded in a web browser, and if it should not, optionally specifies the number of times that the background sound should be played.

Syntax

expression.SetBackgroundSoundRepeat (RepeatForever, RepeatTimes)

expression A variable that represents a WebPageOptions object.

Parameters

Name Required/Optional Data type Description
RepeatForever Required Boolean Specifies whether the background sound should be played infinitely. The value of this parameter is used to populate the value of the BackgroundSoundLoopForever property.
RepeatTimes Optional Long Specifies how many times the background sound should be played. The value of this parameter is used to populate the value of the BackgroundSoundLoopCount property.

Remarks

If the RepeatForever parameter is set to True, the optional RepeatTimes parameter cannot be specified. Attempting to specify RepeatTimes if RepeatForever is True results in a run-time error.

If the RepeatForever parameter is set to False, the optional RepeatTimes parameter must be specified. Omitting RepeatTimes if RepeatForever is False results in a run-time error.

Example

The following example sets the background sound for page four of the active web publication to a .wav file on the local computer. If BackgroundSoundLoopForever is False, the SetBackgroundSoundRepeat method is used to specify that the background sound be repeated infinitely (note the omission of the RepeatTimes parameter).

If BackgroundSoundLoopForever is True, the SetBackgroundSoundRepeat method is used to specify that the background sound not be repeated infinitely, but that it should be repeated twice.

Dim theWPO As WebPageOptions 
 
Set theWPO = ActiveDocument.Pages(4).WebPageOptions 
 
With theWPO 
 .BackgroundSound = "C:\CompanySounds\corporate_jingle.wav" 
 If .BackgroundSoundLoopForever = False Then 
 .SetBackgroundSoundRepeat RepeatForever:=True 
 ElseIf .BackgroundSoundLoopForever = True Then 
 .SetBackgroundSoundRepeat RepeatForever:=False, RepeatTimes:=2 
 End If 
 
End With

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.