Content Supported by Sourcelens Consulting
VERSION 5.00
Begin VB.UserDocument FirstDoc
ClientHeight = 2130
ClientLeft = 0
ClientTop = 900
ClientWidth = 4770
HScrollSmallChange= 225
ScaleHeight = 2130
ScaleWidth = 4770
VScrollSmallChange= 225
Begin VB.TextBox txtFirstDoc
Height = 285
Left = 1800
TabIndex = 4
Top = 1080
Width = 2655
End
Begin VB.TextBox txtURL
Height = 285
Left = 1800
TabIndex = 3
Text = "http://www.microsoft.com"
Top = 465
Width = 2775
End
Begin VB.CommandButton cmdNavigateTo
Caption = "NavigateTo"
Height = 255
Left = 240
TabIndex = 2
Top = 480
Width = 1455
End
Begin VB.CommandButton cmdShowForm
Caption = "Show Form"
Height = 255
Left = 240
TabIndex = 1
Top = 1680
Width = 1455
End
Begin VB.CommandButton cmdGoNext
Caption = "Go Next"
Height = 255
Left = 240
TabIndex = 0
Top = 1095
Width = 1455
End
Begin VB.Menu mnuHelp
Caption = "&Help"
NegotiatePosition= 3 'Right
Begin VB.Menu mnuAbout
Caption = "About FirstDoc"
End
End
End
Attribute VB_Name = "FirstDoc"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
Private Sub cmdGoNext_Click()
Dim strPath As String ' String to be parsed
Dim strAbsPath As String ' Result of parsing
Dim intI As Integer ' Character position counter
' Return the path of the current ActiveX document.
strPath = Trim$(CurDir & "\" & UserDocument.Parent.LocationName)
' Find the position of the last separator character.
For intI = Len(strPath) To 1 Step -1
If Mid$(strPath, intI, 1) = "/" Or _
Mid$(strPath, intI, 1) = "\" Then Exit For
Next intI
' Strip the name of the current .vbd file.
strAbsPath = Left$(strPath, intI)
' Set the global variable to Me, allowing
' the SecndDoc document to get any public
' properties, or call any public functions.
Set gFirstDoc = Me '
' Navigate to the second ActiveX document.
UserDocument.Hyperlink.NavigateTo _
strAbsPath & "SecndDoc.vbd"
End Sub
Private Sub cmdNavigateTo_Click()
' Use the Hyperlink object method NavigateTo
' to go to the URL in txtURL.
Hyperlink.NavigateTo txtURL.Text
End Sub
Private Sub cmdShowForm_Click()
' Show the auxiliary form, and set the Text
' property of txtAux to the URL of FirstDoc.
frmAux.txtAux.Text = txtURL.Text
frmAux.Show vbModal
End Sub
Private Sub mnuAbout_Click()
frmAbout.Show vbModal
End Sub
Private Sub txtFirstDoc_Change()
PropertyChanged
End Sub
Public Property Get strDocProp() As String
strDocProp = txtFirstDoc.Text
End Property
Public Property Let strDocProp(ByVal NewStrDocProp As String)
txtFirstDoc.Text = NewStrDocProp
End Property
Public Property Get txtURLprop() As String
txtURLprop = txtURL.Text
End Property
Public Property Let txtURLprop(ByVal NewTxtURL As String)
txtURL.Text = NewTxtURL
End Property
Private Sub txtURL_Change()
PropertyChanged
End Sub
Private Sub UserDocument_Initialize()
Debug.Print "FirstDoc Initialize"
End Sub
Private Sub UserDocument_InitProperties()
Debug.Print "FirstDoc Init Properties"
End Sub
Private Sub UserDocument_ReadProperties(PropBag As PropertyBag)
txtFirstDoc.Text = _
PropBag.ReadProperty("StrDocProp", _
"Hello")
txtURL.Text = PropBag.ReadProperty("txtURL", "http://www.microsoft.com")
Debug.Print "ReadProperties"
End Sub
Private Sub UserDocument_Terminate()
Debug.Print "FirstDoc Terminate"
End Sub
Private Sub UserDocument_WriteProperties(PropBag As PropertyBag)
PropBag.WriteProperty "StrDocProp", _
txtFirstDoc.Text, "Hello"
PropBag.WriteProperty "txtURL", txtURL.Text, "http://www.microsoft.com"
Debug.Print "WriteProperties"
End Sub