Share via


SetBackgroundSoundRepeat Method [Publisher 2003 VBA Language Reference]

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

expression.SetBackgroundSoundRepeat(RepeatForever, [RepeatTimes])

expression Required. An expression that returns a WebPageOptions object.

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 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 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

Applies to | WebPageOptions Object