And what code lines produce the errors?
One thing I'd do to try to make troubleshooting the code easier is to not
use so many dot operators. It makes it very hard to know what's failing
where. Use a separate variable for each dot operator so you can always test
if that piece of the puzzle is being instantiated correctly, is nothing or
is throwing an exception.
Please leave parts of the preceding thread in your posts, it makes it very
hard to follow a thread when you don't.
Desiboy said:
Ok,
Here are the variable defined and code fragment.
Dim sCombination
Dim nPosition
Dim MyNameSpace
Dim MyApplication
Dim MyInspector
Dim sAttachmentDisplayName
Dim MyWord
Dim MyDoc
''Dim sDocumentLocation
Dim sTemplatePathName
Dim Hospital_Folders
Dim PageDocument
Dim CarrierToClose
Dim MyAddressList
Dim bDebug
------- Below is the code fragment (this appear after the above code)
-----------
Function Item_Read()
bDebug = DebugMode
If bDebug Then MsgBox "Item_Read"
End Function
Function Item_Open()
bDebug = DebugMode
Set MyNameSpace = Application.GetNameSpace("MAPI")
' Test AddressLists - Begin
' For Each MyAddressList In MyNameSpace.AddressLists
' MsgBox "I See AddressList :: " & MyAddressList.Name
' Next
Set MyAddressList = MyNameSpace.AddressLists("Global Address List")
' Set MyDistrList = MyAddressList.AddressEntries("Vice_Presidents")
' For Each MyVicePresident In MyDistrList.Members
' MsgBox " I see Vice President :: " & MyVicePresident.Name
' Next
' Test AddressLists - End
If bDebug Then
MsgBox "Item_Open Event"
Set PageDocument = GetInspector.ModifiedFormPages("Document")
PageDocument.Controls("Label11").Visible = True
PageDocument.Controls("TextBox11").Visible = True
PageDocument.Controls("Label12").Visible = True
PageDocument.Controls("TextBox12").Visible = True
PageDocument.Controls("Label13").Visible = True
PageDocument.Controls("TextBox4").Visible = True
PageDocument.Controls("Label14").Visible = True
PageDocument.Controls("TextBox2").Visible = True
PageDocument.Controls("CommandButtonTest").Visible = True
End If
Set CarrierToClose = Nothing
' For Each MyItem In
MyNameSpace.GetDefaultFolder(6).Items.Restrict("[Subject]='Document
Handling
Notification'")
' MsgBox MyItem.Categories
' Next
sCurrentUserName = MyNameSpace.CurrentUser.Name
If bDebug Then MsgBox "Current User Name :: " & sCurrentUserName
Set MyInspector = GetInspector
sAttachmentDisplayName = "Recruitment Requisition"
sTemplatePathName = "C:\Temp\Templates\" & sAttachmentDisplayName &
"T.dot"
'' sDocumentLocation = "C:\Temp\" & sAttachmentDisplayName & "D.doc"
RestrictCommandBars
SetRootFolder
' MsgBox "Unread :: " & Unread
If bDebug Then MsgBox "Sender Name :: " & SenderName
If UserProperties.Find("RequisitionFrom") = "" Then
UserProperties.Find("RequisitionFrom") = sCurrentUserName
End If
' If SenderName = "" Or UserProperties.Find("RequisitionFrom")=
sCurrentUserName Then
' If bDebug Then MsgBox "Expose to Author"
' ExposeToAuthor
' Else
' If bDebug Then MsgBox "NextToSign :: " &
UserProperties.Find("NextToSign")
' If UserProperties.Find("Submitted") And
UserProperties.Find("NextToSign")
= sCurrentUserName Then
' ExposeForSigning
' Else
' If bDebug Then MsgBox "Disable Everything"
' Alive( False )
' End If
' End If
If SenderName = "" Then
If bDebug Then MsgBox "Expose to Author"
ExposeToAuthor
Else
If bDebug Then MsgBox "NextToSign :: " & UserProperties.Find("NextToSign")
If UserProperties.Find("Submitted") And UserProperties.Find("NextToSign")
= sCurrentUserName Then
ExposeForSigning
Else
If UserProperties.Find("RequisitionFrom")= sCurrentUserName Then
If bDebug Then MsgBox "Expose to Author"
ExposeToAuthor
Else
If bDebug Then MsgBox "Disable Everything"
Alive( False )
End If
End If
End If
End Function