Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Public Function SendMail(Recip As String, Optional Subject As Variant, Optional Message As Variant, Optional Attach As Variant)
Dim intChan As Variant
Dim GroupwiseID As Long
Dim strCommand, strParam As String
Dim boolGWOpen As Boolean
Dim strQuote As String
Dim retval As Long
'the following path needs to point to where Groupwise is installed
Const strGWApp = "G:\software\client\win32\GrpWise.exe"
On Error Resume Next
strQuote = Chr(34)
intChan = DDEInitiate("GroupWise", "Command") 'Attempt to establish conversation with GroupWise
If Err Then 'If an error occurs, GroupWise is not open
boolGWOpen = False 'Set the flag to false
Err = 0 'Reset error
GroupwiseID = Shell(strGWApp) 'Open GroupWise minimized without focus
If Err Then 'If another error occurs then exit
MsgBox "GroupWise could not be started", vbOKOnly + vbInformation, "Error loading GroupWise"
Exit Function
End If
On Error GoTo GroupWise_Not_Open
GroupWise_Try_Again:
intChan = DDEInitiate("GroupWise", "Command") 'Attempt to establish GroupWise link
Else
boolGWOpen = True 'GroupWise was open
End If
On Error GoTo Err_SendMail
'Build the parameter string
If IsMissing(Subject) And IsMissing(Message) And IsMissing(Attach) Then
strParam = strQuote & Recip & strQuote
ElseIf IsMissing(Subject) And IsMissing(Message) Then
strParam = strQuote & Recip & strQuote & "; ; ; " & strQuote & Attach & strQuote
ElseIf IsMissing(Message) And IsMissing(Attach) Then
strParam = strQuote & Recip & strQuote & "; " & strQuote & Subject & strQuote
ElseIf IsMissing(Subject) And IsMissing(Attach) Then
strParam = strQuote & Recip & strQuote & "; ; " & strQuote & Message & strQuote
ElseIf IsMissing(Subject) Then
strParam = strQuote & Recip & strQuote & "; ; " & strQuote & Message & strQuote & "; " & strQuote & Attach & strQuote
ElseIf IsMissing(Message) Then
strParam = strQuote & Recip & strQuote & "; " & strQuote & Subject & strQuote & "; ;" & strQuote & Attach & strQuote
ElseIf IsMissing(Attach) Then
strParam = strQuote & Recip & strQuote & "; " & strQuote & Subject & strQuote & "; " & strQuote & Message & strQuote
Else
strParam = strQuote & Recip & strQuote & "; " & strQuote & Subject & strQuote & "; " & strQuote & Message & strQuote & "; " & strQuote & Attach & strQuote
End If
'Build the Command string
strCommand = "SendMail(" & strParam & ")"
'Send the mail message
DDEExecute intChan, strCommand
'Close the GroupWise link
DDETerminate intChan
If Not boolGWOpen Then 'If GroupWise was not open
'AppActivate GroupwiseID, True 'Activate the Groupwise window
AppActivate "GroupWise - Mailbox", False
SendKeys "%{F4}", True 'Close GroupWise
End If
Exit_SendMail:
Exit Function
GroupWise_Not_Open:
Err = 0 'Reset error
Resume GroupWise_Try_Again 'Re-attempt to establish conversation with GroupWise
Err_SendMail:
MsgBox Err.Description
Resume Exit_SendMail
End Function
SendMail("someone@somewhere.com","Title of Email","Email text","File attatchment path")
strTo = "someone@somewhere.com"
strTitle = "Hello Dave"
strMsg = "This should sort you out..."
strFile = "C:/Files/somefile.txt"
SendMail(strTo, strTitle, strMsg, strFile)