Problem Running Macro Attaching File to E-Mail

TooZippy

Board Regular
Joined
Dec 30, 2018
Messages
70
I tried using this macro that I found on the web and it tells me "User defined type not defined" and points to "objGW As GoupwareTypeLibrary.Application". I thought that this was defined with the Dim statement below?

Here is the macro...

Code:
Sub send_mail()
DoCmd.Hourglass True

Dim strFrom, strSubject, strBody
Dim objGW As GroupwareTypeLibrary.Application                                                                                      "

[COLOR=green]'   Type in the Subject here. 'Pretty self explanatory[/COLOR]
strSubject = "Subject Text"

[COLOR=green]'   One of the perks of using code is that you can include body text.'You can include returns in the body of the email by using 'Chr(10)'.'You can indent text by using 'Chr(9)', which is a single tab.[/COLOR]
strBody = "Body text." & Chr(10) & Chr(10) & _
    Chr(9) & "This text will be separated by returns and a tab."

Set objGW = New GroupwareTypeLibrary.Application

    With objGW
        With .Login
            With .MailBox.Messages.Add(Class:="GW.MESSAGE.MAIL")
                .Subject.PlainText = strSubject
                .Bodytext.PlainText = strBody
                .FromText = strFrom
                .Attachments.Add "C:\FilePath\File_Name.xls"
                .Recipients.Add "someone@somewhere.com"
                
[COLOR=#000000]End With
End With
        .Quit
    End With
    Set objGW = Nothing[/COLOR]

[COLOR=green]'   Turn the hourglass off[/COLOR]
DoCmd.Hourglass = False
End Sub

Thank you.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
GroupwaretypeLibrary relates to a non-Microsoft email system (Novell) if you have Novell check the references under the tools Menu in VBA and select it from there, if not try using the outlook type library instead, under Microsoft outlook type 15.0 Object Library under tools references
 
Upvote 0

Forum statistics

Threads
1,214,551
Messages
6,120,159
Members
448,948
Latest member
spamiki

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top