473,382 Members | 1,247 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

AccessXP/Groupwise fix

Hi All,
Below is a function I want to use in AccessXP, it works as is but as
the comment says I need to manually open Tools - References and check
off 'Groupware Type Library' and I'm hoping someone here can show me
some sample code so I do not have to do that manually. If I run this
without that library checked off I get this error message
'Compile Error - User Defined Type Not Defined'
thanks
bobh.

Public Function SendGWMail(DisplayMsg As Boolean, _
strTo As String, strCC As String, strBCC As String, _
strSubject As String, strBody As String, strAttachPathFile As String)
As Boolean

' In order for this function to work you must check Groupware Type
Library under Tools - References
' This will log you in to Groupwise if you are not logged in already
except if you have your
' Groupwise account password protected then you must log-in to
Groupwise first.
Const NGW$ = "NGW"
Dim GWCom As Object
Dim RetStr As String, MessageId As String

SendGWMail = False

' Create the Groupwise session
Dim gwappl As GroupwareTypeLibrary.Application2
Dim gwacc As GroupwareTypeLibrary.Account2
Dim gwnewmessage As GroupwareTypeLibrary.Message

Set gwappl = CreateObject("NovellGroupWareSession")
Set gwacc = gwappl.Login
Set gwnewmessage = gwacc.WorkFolder.Messages.Add("GW.Message.mail",
egwDraft)

' Create the message
With gwnewmessage
With .Recipients
' Add the To recipient(s) to the message
If (strTo <"") Then
'.Add strTo
.Add strTo, NGW, egwTo
End If
' Add the CC recipient(s) to the message
If (strCC <"") Then
.Add strCC, NGW, egwCC
End If
' Add the BCC recipient(s) to the message
If (strBCC <"") Then
.Add strBCC, NGW, egwBC
End If
End With

' Set the Subject, Body, and Importance of the message
.Subject = strSubject
.BodyText = strBody
.Priority = egwHigh

' Add attachments to the message.
If (strAttachPathFile <"") Then
.Attachments.Add strAttachPathFile, egwFile
End If

' Should we display the message before sending?
If DisplayMsg Then
' Display message to user
MessageId = .MessageId
Set GWCom = CreateObject("GroupwiseCommander")
GWCom.Execute "ItemOpen (""" & MessageId & """)", RetStr
GWCom.Execute "ItemSetText (""X00"";To!; """ & strTo & """; 0)",
RetStr
Else
.Send
End If

End With

SendGWMail = True
Set gwnewmessage = Nothing

End Function

May 15 '07 #1
2 3499
Ooops! I should also mention that is in an application that I'll be
distributing to several other users and I don't want to have to go to
each users pc and check off the reference.

and the line of code it highlights with the error is the first set
command
Set gwappl = CreateObject("NovellGroupWareSession")
I'm assuming whatever I need to do for the first Set command I'll also
need to do for the second Set command and maybe the third.
bobh.

On May 15, 1:24 pm, bobh <vulca...@isp.comwrote:
Hi All,
Below is a function I want to use in AccessXP, it works as is but as
the comment says I need to manually open Tools - References and check
off 'Groupware Type Library' and I'm hoping someone here can show me
some sample code so I do not have to do that manually. If I run this
without that library checked off I get this error message
'Compile Error - User Defined Type Not Defined'
thanks
bobh.

Public Function SendGWMail(DisplayMsg As Boolean, _
strTo As String, strCC As String, strBCC As String, _
strSubject As String, strBody As String, strAttachPathFile As String)
As Boolean

' In order for this function to work you must check Groupware Type
Library under Tools - References
' This will log you in to Groupwise if you are not logged in already
except if you have your
' Groupwise account password protected then you must log-in to
Groupwise first.
Const NGW$ = "NGW"
Dim GWCom As Object
Dim RetStr As String, MessageId As String

SendGWMail = False

' Create the Groupwise session
Dim gwappl As GroupwareTypeLibrary.Application2
Dim gwacc As GroupwareTypeLibrary.Account2
Dim gwnewmessage As GroupwareTypeLibrary.Message

Set gwappl = CreateObject("NovellGroupWareSession")
Set gwacc = gwappl.Login
Set gwnewmessage = gwacc.WorkFolder.Messages.Add("GW.Message.mail",
egwDraft)

' Create the message
With gwnewmessage
With .Recipients
' Add the To recipient(s) to the message
If (strTo <"") Then
'.Add strTo
.Add strTo, NGW, egwTo
End If
' Add the CC recipient(s) to the message
If (strCC <"") Then
.Add strCC, NGW, egwCC
End If
' Add the BCC recipient(s) to the message
If (strBCC <"") Then
.Add strBCC, NGW, egwBC
End If
End With

' Set the Subject, Body, and Importance of the message
.Subject = strSubject
.BodyText = strBody
.Priority = egwHigh

' Add attachments to the message.
If (strAttachPathFile <"") Then
.Attachments.Add strAttachPathFile, egwFile
End If

' Should we display the message before sending?
If DisplayMsg Then
' Display message to user
MessageId = .MessageId
Set GWCom = CreateObject("GroupwiseCommander")
GWCom.Execute "ItemOpen (""" & MessageId & """)", RetStr
GWCom.Execute "ItemSetText (""X00"";To!; """ & strTo & """; 0)",
RetStr
Else
.Send
End If

End With

SendGWMail = True
Set gwnewmessage = Nothing

End Function

May 15 '07 #2
bobh <vu******@isp.comwrote:
>Below is a function I want to use in AccessXP, it works as is but as
the comment says I need to manually open Tools - References and check
off 'Groupware Type Library' and I'm hoping someone here can show me
some sample code so I do not have to do that manually.
Late binding means you can safely remove the reference and only have an error when
the app executes lines of code in question. Rather than erroring out while starting
up the app and not allowing the users in the app at all. Or when hitting a mid, left
or trim function call.

You'll want to install the reference if you are programming or debugging and want to
use the object intellisense while in the VBA editor. Then,. once your app is
running smoothly, remove the reference and setup the late binding statements.

Sample code:
' Declare an object variable to hold the object
' reference. Dim as Object causes late binding.
Dim objWordDoc As Object
Set objWordDoc = CreateObject(" Word.Document")

For more information including additional text and some detailed links see the "Late
Binding in Microsoft Access" page at http://www.granite.ab.ca/access/latebinding.htm

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
May 15 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dennis Hartmann | last post by:
Has anyone found a "display" method for the GroupwareTypeLibrary.Message object, comparable to the Display method of the Outlook.MailItem object? I simply want end user or have the option of...
2
by: Norman Fritag | last post by:
Hi there are there any issues with sending multiple emails via GroupWise ver. 6??? please comment. Regards Norman
1
by: Molly J. Fagan | last post by:
Hello everyone-- I'm trying to develop a help desk system to replace Trak-It. We have a help desk e-mail address and want all messages sent to that e-mail address to go into an Access database...
1
by: Atim | last post by:
I'm trying to create an email message in Novell Groupwise (from Access) which the user can edit before sending. Using the code below, I can create a message just fine, but the problem is that it...
5
by: Laertes | last post by:
Hi, I know there is already a plethora of emails regarding Groupwise/Access problems but mine is slightly different to the ones I've read about. I'm trying to use the sendobject command to...
0
by: Bob Hynes | last post by:
Hi All, In one of my Access97 db applications I created a report which I output to a RichTextFormat file attach it to an Email and send it out, that has worked just fine for a couple of years now....
2
by: acewood1 | last post by:
I've done some searching in the archives but can't seem to find an easy answer as to how to send a Groupwise email through Access 2003. I just need to open a new email and populate the "To:" line...
46
by: pixie | last post by:
Hi. I have an Access DB that is for contracts. I have used the code found on Tony's site for emailing a report per person containing only their information using GroupWise. It works great but I...
4
by: bobh | last post by:
Hi All, I have an AccessXP vba procedure which attaches a report to Groupwise and sends it to recipients. That line of code looks like this MailApplication.Recipients.Add strTo this...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.