Highlighted
Anonymous_User Absent Member.
Absent Member.
2399 views

Preview Draft Messages before sending: using VBA

I was asked to post in the Developer forum...
>>Hello,

Our business needs require an e-mail to be created with specific emails addresses, Subject, Body and Attachments and then staged in the "Work In Progress" folder within groupwise. Then these e-mails are reviewed to make sure that the attachments (Sensitive information) are appropriate for the addressees. once this verification is completed then the e-mails are sent.

I am able to get everything mentioned above to work except to have the names of the recipients show up in the draft e-mails contained within the Work In Progress folder.

The Code below is an extract of what i am have with the relevant parts included. The only pieces missing are the attachments.


The funny thing is that if as the last step i choose to have the e-mail sent (.Send) it will send it to the addressees, but i just am not able to see the e-mails in the draft message.

I would greatly appreciate if someone can help me here. The VBA is running in Excel 2007.

Sub CreateMailPullingAttachmentsfromafolder ()
CreateMailPullingAttachmentsfromafolder Macro
'
Dim ogwApp As GroupwareTypeLibrary.Application
Dim ogwRootAcct As GroupwareTypeLibrary.Account
Dim fso As New FileSystemObject
Dim flds As Folders

Dim ogwFolder As Folder, _
ogwFoundFolder As Folder, _
i As Long, _
StartCount1 As Long, _
StartCount2 As Long, _
sCommandOptions As String, _
sMailPassword As String, _
sLoginName As String, _
sFolderToSearch As String, _
sFileType As String, _
sSavePath As String, _
ogwMail As Mail, _
aryTo() As String, _
aryCC() As String, _
aryBCC() As String



'If ogwApp Is Nothing Then 'Need to set object reference
'DoEvents
Set ogwApp = CreateObject("NovellGroupWareSession")
DoEvents
'End If


Set ogwRootAcct = ogwApp.Login
DoEvents
sFolderToSearch = "Work In Progress"

Set MyWorkFolder = ogwRootAcct.AllFolders.ItemByName(sFolderToSearch)
Set MyMessages = MyWorkFolder.Messages
Set MyDraftMsg = MyMessages.Add()
MyDraftMsg.Recipients.Add ("Raj.Pov@XXXcvc.com")
With MyDraftMsg
'Assign the SUBJECT text
' .Subject = StrSubject
'Assign the BODY text
' .Priority = egwLow

' .BodyText = StrBody


'
End With
'
'Release all objects before closing
Set ogwRootAcct = Nothing
Set ogwApp = Nothing
DoEvents

End Sub
Labels (1)
Tags (1)
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.