Microsoft Office 2000/Visual Basic Programmer's Guide   

Understanding Subscriptions

You use subscriptions to specify the time and type of notification to send when changes occur to the discussions in a document or to any document within a specified folder. For example, the following code creates a subscription to a Web page. The subscription specifies that an e-mail message should be immediately sent to user@host.domain.com when a discussion item is inserted or deleted on the specified Web page:

strURL = "http://msdn.microsoft.com/officedev/topten.htm"
strMailTo = "user@host.domain.com"
AddOfficeServerSubscription FileURL:=strURL, _
   NotifyWhen:=oseNotifyWhenDiscussionAnything, _
   MailTo:=strMailTo, MailTime:=oseMailImmediately

In this instance, an e-mail message is generated whenever a discussion item is added to or deleted from the Topten.htm page. This VBA code has the same effect as opening the Document Subscription dialog box and entering the values shown in Figure 12.13.

Figure 12.13 The Document Subscription Dialog Box

Although you can add a subscription programmatically, there is no way to work with existing subscriptions by using VBA code.