Function Main As String
  Dim Answer As Integer
  Answer=MessageBox("Hello, Molecules!","Example #1", MBB_OK +MBI_EXCLAMATION)
  Answer=MessageBox("Say Hello to all? ","Example #1", MBB_YESNO + MBI_QUESTION)
  If Answer= MBR_YES Then
    Call GreetThemAll
    Main=" Everybody welcomed."
  Else
    Main="Sorry, we leave them."
  End If
End Function

Sub GreetThemAll
Dim Diagram As Object, Answer As Integer, MolName,Tail As String
Tail=Chr(13)+Chr(13)+Chr(13)+"Greet the next?"
With ActiveDocument.ActivePage.Diagrams
  For Each Diagram in .Self
    MolName=Diagram.GetIUPACName
    If Trim(MolName)="" Then MolName="though I can not pronounce your name"
    Answer=MessageBox("Hello, "+MolName+"!"+Tail,"Example #1", MBB_OKCANCEL+MBI_EXCLAMATION)
    If Answer= MBR_CANCEL  Then Exit For
  Next Diagram
End With
End Sub