Implements ISmartDocument
Dim spath As String
'Namespace constant
Const cNAMESPACE As String = "SDCloseonInit"
'Element constants
Const cTEXTBOX As String = cNAMESPACE & "#textbox"
Const cBUTTON As String = cNAMESPACE & "#commandbutton"
Const cTypes As Integer = 2
Private Sub ISmartDocument_SmartDocInitialize(ByVal ApplicationName As String, ByVal Document As Object,
ByVal SolutionPath As String, ByVal SolutionRegKeyRoot As String)
spath = SolutionPath
If ApplicationName = "Word.Application.11" Then
Dim solutionDoc As Word.Document
Set solutionDoc = Document
solutionDoc.Close False 'This line causes the error.
Else
Dim solutionBook As Workbook
Set solutionBook = Document
solutionBook.Close False 'This line causes the error.
End If
On Error GoTo SDIERR
Exit Sub
SDIERR:
MsgBox "Solution error:" & Err.Description
Err.Clear
Resume Next
End Sub
Private Property Get ISmartDocument_SmartDocXmlTypeCount() As Long
ISmartDocument_SmartDocXmlTypeCount = cTypes
End Property
Private Property Get ISmartDocument_SmartDocXmlTypeName( _
ByVal XMLTypeID As Long) As String
Select Case XMLTypeID
Case 1
ISmartDocument_SmartDocXmlTypeName = cTEXTBOX
Case 2
ISmartDocument_SmartDocXmlTypeName = cBUTTON
Case Else
End Select
End Property
Private Property Get ISmartDocument_SmartDocXmlTypeCaption( _
ByVal XMLTypeID As Long, ByVal LocaleID As Long) As String
Select Case XMLTypeID
Case 1
ISmartDocument_SmartDocXmlTypeCaption = "Textbox"
Case 2
ISmartDocument_SmartDocXmlTypeCaption = "Click"
Case Else
End Select
End Property
Private Property Get ISmartDocument_ControlCount( _
ByVal XMLTypeName As String) As Long
Select Case XMLTypeName
Case cTEXTBOX
ISmartDocument_ControlCount = 1
Case cBUTTON
ISmartDocument_ControlCount = 1
Case Else
End Select
End Property
'The ControlID for the first control that you add is 1.
'For additional information about how to specify the ControlID, see the ControlID reference
'topic in the References section of this SDK.
Private Property Get ISmartDocument_ControlID( _
ByVal XMLTypeName As String, _
ByVal ControlIndex As Long) As Long
Select Case XMLTypeName
Case cTEXTBOX
ISmartDocument_ControlID = ControlIndex
Case cBUTTON
ISmartDocument_ControlID = ControlIndex + 100
Case Else
End Select
End Property
Private Property Get ISmartDocument_ControlNameFromID( _
ByVal ControlID As Long) As String
ISmartDocument_ControlNameFromID = cNAMESPACE & ControlID
End Property
Private Property Get ISmartDocument_ControlCaptionFromID( _
ByVal ControlID As Long, ByVal ApplicationName As String, _
ByVal LocaleID As Long, ByVal Text As String, _
ByVal Xml As String, ByVal Target As Object) As String
Select Case ControlID
Case 1
ISmartDocument_ControlCaptionFromID = _
"Enter your name:"
Case 101
ISmartDocument_ControlCaptionFromID = _
"Test button"
Case Else
End Select
End Property
Private Property Get ISmartDocument_ControlTypeFromID( _
ByVal ControlID As Long, _
ByVal ApplicationName As String, _
ByVal LocaleID As Long) As SmartTagLib.C_TYPE
Select Case ControlID
Case 1
ISmartDocument_ControlTypeFromID = C_TYPE_TEXTBOX
Case 101
ISmartDocument_ControlTypeFromID = C_TYPE_BUTTON
Case Else
End Select
End Property
Private Sub ISmartDocument_PopulateActiveXProps(ByVal ControlID As Long, ByVal ApplicationName As String,
ByVal LocaleID As Long, ByVal Text As String, ByVal Xml As String, ByVal Target As Object,
ByVal Props As SmartTagLib.ISmartDocProperties, ByVal ActiveXPropBag As SmartTagLib.ISmartDocProperties)
End Sub
Private Sub ISmartDocument_PopulateCheckbox(ByVal ControlID As Long, ByVal ApplicationName As String,
ByVal LocaleID As Long, ByVal Text As String, ByVal Xml As String, ByVal Target As Object,
ByVal Props As SmartTagLib.ISmartDocProperties, Checked As Boolean)
End Sub
Private Sub ISmartDocument_PopulateDocumentFragment(ByVal ControlID As Long, ByVal ApplicationName As String,
ByVal LocaleID As Long, ByVal Text As String, ByVal Xml As String, ByVal Target As Object,
ByVal Props As SmartTagLib.ISmartDocProperties, DocumentFragment As String)
End Sub
Private Sub ISmartDocument_PopulateHelpContent(ByVal ControlID As Long, ByVal ApplicationName As String,
ByVal LocaleID As Long, ByVal Text As String, ByVal Xml As String, ByVal Target As Object,
ByVal Props As SmartTagLib.ISmartDocProperties, Content As String)
End Sub
Private Sub ISmartDocument_PopulateImage(ByVal ControlID As Long, ByVal ApplicationName As String,
ByVal LocaleID As Long, ByVal Text As String, ByVal Xml As String, ByVal Target As Object,
ByVal Props As SmartTagLib.ISmartDocProperties, ImageSrc As String)
End Sub
Private Sub ISmartDocument_PopulateListOrComboContent(ByVal ControlID As Long,
ByVal ApplicationName As String, ByVal LocaleID As Long, ByVal Text As String,
ByVal Xml As String, ByVal Target As Object, ByVal Props As SmartTagLib.ISmartDocProperties,
List() As String, count As Long, InitialSelected As Long)
End Sub
Private Sub ISmartDocument_PopulateOther(ByVal ControlID As Long, ByVal ApplicationName As String,
ByVal LocaleID As Long, ByVal Text As String, ByVal Xml As String, ByVal Target As Object,
ByVal Props As SmartTagLib.ISmartDocProperties)
End Sub
Private Sub ISmartDocument_PopulateRadioGroup(ByVal ControlID As Long, ByVal ApplicationName As String,
ByVal LocaleID As Long, ByVal Text As String, ByVal Xml As String, ByVal Target As Object,
ByVal Props As SmartTagLib.ISmartDocProperties, List() As String, count As Long, InitialSelected As Long)
End Sub
Private Sub ISmartDocument_PopulateTextboxContent( _
ByVal ControlID As Long, ByVal ApplicationName As String, _
ByVal LocaleID As Long, ByVal Text As String, _
ByVal Xml As String, ByVal Target As Object, _
ByVal Props As SmartTagLib.ISmartDocProperties, Value As String)
End Sub
Private Sub ISmartDocument_ImageClick(ByVal ControlID As Long, ByVal ApplicationName As String,
ByVal Target As Object, ByVal Text As String, ByVal Xml As String, ByVal LocaleID As Long,
ByVal XCoordinate As Long, ByVal YCoordinate As Long)
End Sub
Private Sub ISmartDocument_InvokeControl(ByVal ControlID As Long, ByVal ApplicationName As String,
ByVal Target As Object, ByVal Text As String, ByVal Xml As String, ByVal LocaleID As Long)
End Sub
Private Sub ISmartDocument_OnCheckboxChange(ByVal ControlID As Long, ByVal Target As Object,
ByVal Checked As Boolean)
End Sub
Private Sub ISmartDocument_OnListOrComboSelectChange(ByVal ControlID As Long, ByVal Target As Object,
ByVal Selected As Long, ByVal Value As String)
End Sub
Private Sub ISmartDocument_OnRadioGroupSelectChange(ByVal ControlID As Long, ByVal Target As Object,
ByVal Selected As Long, ByVal Value As String)
End Sub
Private Sub ISmartDocument_OnTextboxContentChange( _
ByVal ControlID As Long, ByVal Target As Object, _
ByVal Value As String)
End Sub
Private Sub ISmartDocument_OnPaneUpdateComplete(ByVal Document As Object)
End Sub