PDA

View Full Version : Groupwise Attachment Printing



halldo67
12-21-2009, 08:21 AM
Hello all,
I have a project to investigate a Groupwise Mailbox twice a day and print any attachments for record keeping purposes. When using Groupwise, if one highlights the message and select print from the file menu, a dialog opens where the user can select what they would like to print. By highlighting the attachment(s) just the selection is printed. I have the attached code that will review all the attachments in incoming mail and save them if they are of a certain file type. However I would rather send them to the printer. This is were the problem comes in using the Groupware Type Library for mail, I can not locate any print commands. Does anyone know of a method to print the attachments or is there a different Groupwise Library that should be used.

Also in looking at other posts, it looks as though you can paste the code right into a window on the posting itself. I could not figure this out, can someone explain how to do this.

Any help would be greatly appreciated.
Halldo67


Public Sub testGroupwise()
Dim ogwMessage As GroupwareTypeLibrary.Mail, strMailPassword As String, sCommandOptions As String
Dim lIndex As Long, strTemp As String, strTo As String, strLoginName As String, strSubject As String
Dim strBody As String, I As Double, ogwMail As Object, T As Double, strFold As String, D As Double
Dim strBox As String, M As Variant, msgs As Variant, strSearch As String
'FROM VBA Express Title "Multiple attachments to GroupWise Email with VBA code"
'http://www.vbaexpress.com/forum/showthread.php?t=9498&highlight=Groupwise
'SECTION 2
'Set all required variables
strMailPassword = "********" 'A true password is not required
strLoginName = "halldo67@allcare.com"
'SECTION 3
'Create the Groupwise object and login in to Groupwise

'Set application object reference if needed
If ogwApp Is Nothing Then 'need to set object reference
DoEvents
Set ogwApp = CreateObject("NovellGroupWareSession")
DoEvents
End If
If ogwRootAcct Is Nothing Then 'Need to log in
'Login to root account
If Len(strMailPassword) Then 'Password was passed, so use it
sCommandOptions = "/pwd=" & strMailPassword
Else 'Password was not passed
sCommandOptions = vbNullString
End If

Set ogwRootAcct = ogwApp.Login(strLoginName, sCommandOptions, _
, egwPromptIfNeeded)
DoEvents

End If

strSearch = "(BOX_TYPE = INCOMING AND MAIL)"

For D = 1 To ogwRootAcct.AllFolders(2).Messages.Find(strSearch).Count
strSubject = ogwRootAcct.AllFolders(2).Messages.Find(strSearch).Item(D).Subject
'Test for Attachements and Attachment Type
For T = 1 To ogwRootAcct.AllFolders(2).Messages.Find(strSearch).Item(D).Attachments.Coun t
If ogwRootAcct.AllFolders(2).Messages.Find(strSearch).Item(D).Attachments.Item (T).ObjType <> egwMessage Then
If Right(ogwRootAcct.AllFolders(2).Messages.Find(strSearch).Item(D).Attachment s.Item(T).Filename, 3) <> "htm" Then
If Right(ogwRootAcct.AllFolders(2).Messages.Find(strSearch).Item(D).Attachment s.Item(T).Filename, 3) <> "jpg" Then
'Save File To Directory - Would rather Print here
ogwRootAcct.AllFolders(2).Messages.Find(strSearch).Item(D).Attachments.Item (T).Save ("c:\Test\" & ogwRootAcct.AllFolders(2).Messages.Find(strSearch).Item(D).Attachments.Item (T).Filename)
End If
End If
End If
Next T
Next D
End Sub

geekgirlau
12-21-2009, 09:33 PM
I can't offer any help with Groupwise I'm afraid, however to post code paste the text in your post, select it, then click on the "VBA" button.

halldo67
12-22-2009, 06:35 AM
Geekgirlau,
Thanks for the tip it works wonderfully.
Halldo67