MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Feb 20th, 2002, 05:22 PM   #1
brettvba
MrExcel MVP
 
Join Date: Feb 2002
Location: Christchurch New Zealand
Posts: 1,030
Default

brettvba is offline   Reply With Quote
Old Feb 20th, 2002, 05:37 PM   #2
Jack in the UK
Board Regular
 
Join Date: Feb 2002
Posts: 3,064
Default

HI

Thats blank also please try again

Rdgs
==========
Jack
Jack in the UK is offline   Reply With Quote
Old Feb 20th, 2002, 05:42 PM   #3
brettvba
MrExcel MVP
 
Join Date: Feb 2002
Location: Christchurch New Zealand
Posts: 1,030
Default

Ok not sure why my posts are blank must be mental

Q was does anyone have any code for sending
XP Workbooks through Lotus Notes?
Lotus notes is an email programme.
brettvba is offline   Reply With Quote
Old Feb 20th, 2002, 05:52 PM   #4
Jack in the UK
Board Regular
 
Join Date: Feb 2002
Posts: 3,064
Default

Hi --

Notes is Lotus (IBM) and very very very very very very ........ good. Better that outlook i add but...


Office suite uses VBA and Lotus IBM Scripts and i never have hurd of VBA talking to Notes as bit like English and French, not ike English and American or Australian basic the same not so here...

Also i do not know anyone that programs in IBM.. al i suggest is check web for notes Scripts and homepage.

Sorry mate

Rdgs
==========
Jack
Jack in the UK is offline   Reply With Quote
Old Feb 20th, 2002, 05:59 PM   #5
brettvba
MrExcel MVP
 
Join Date: Feb 2002
Location: Christchurch New Zealand
Posts: 1,030
Default

Yeah I know there is something there under the references but otherwise not a big deal thanks anyway!
brettvba is offline   Reply With Quote
Old Feb 20th, 2002, 06:05 PM   #6
NateO
Legend
 
NateO's Avatar
 
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
Default

I'm in a hurry and gotta run, so I can't go through it but the following works for me:

Code:
Private Sub SendNotesMail()
    Dim Maildb As Object
    Dim UserName As String
    Dim MailDbName As String
    Dim MailDoc As Object
    Dim AttachME As Object
    Dim Session As Object
    Dim EmbedObj1 As Object
    Dim EmbedObj2 As Object
    Dim EmbedObj4 As Object
    Dim EmbedObj5 As Object
    Dim EmbedObj6 As Object
    Dim EmbedObj7 As Object
    Dim EmbedObj8 As Object
    Dim EmbedObj9 As Object
    Dim EmbedObj10 As Object
    Set Session = CreateObject("Notes.NotesSession")
    UserName = Session.UserName
    MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
    Set Maildb = Session.GETDATABASE("", MailDbName)
     If Maildb.IsOpen = True Then
     Else
         Maildb.OPENMAIL
     End If
    Set MailDoc = Maildb.CREATEDOCUMENT
    MailDoc.Form = "Memo"
    Recipient = Range("a15").Value
    MailDoc.sendto = Recipient
    ccRecipient = Range("b15").Value
    MailDoc.CopyTo = ccRecipient
    bccRecipient = Range("c15").Value
    MailDoc.BlindCopyTo = bccRecipient
    Subject = Range("it25")
    MailDoc.Subject = Subject
    BodyText = Range("b8")
    MailDoc.Body = BodyText
    MailDoc.SAVEMESSAGEONSEND = True     Attachment1 = Range("d15")
    If Attachment1 <> "" Then
        On Error Resume Next
        Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
        On Error Resume Next
        Set EmbedObj1 = AttachME.EMBEDOBJECT(1454, "", Attachment1, "Attachment")
        On Error Resume Next
        MailDoc.CREATERICHTEXTITEM ("Attachment")
        On Error Resume Next
    End If
Attachment2 = Range("e15")
    If Attachment2 <> "" Then
        On Error Resume Next
        Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
        On Error Resume Next
        Set EmbedObj2 = AttachME.EMBEDOBJECT(1454, "", Attachment2, "Attachment")
        On Error Resume Next
        MailDoc.CREATERICHTEXTITEM ("Attachment")
        On Error Resume Next
    End If
Attachment3 = Range("f15")
    If Attachment3 <> "" Then
        On Error Resume Next
        Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
        On Error Resume Next
        Set EmbedObj3 = AttachME.EMBEDOBJECT(1454, "", Attachment3, "Attachment")
        On Error Resume Next
        MailDoc.CREATERICHTEXTITEM ("Attachment")
        On Error Resume Next
    End If
Attachment4 = Range("g15")
    If Attachment4 <> "" Then
        On Error Resume Next
        Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
        On Error Resume Next
        Set EmbedObj4 = AttachME.EMBEDOBJECT(1454, "", Attachment4, "Attachment")
        On Error Resume Next
        MailDoc.CREATERICHTEXTITEM ("Attachment")
        On Error Resume Next
    End If
Attachment5 = Range("h15")
    If Attachment5 <> "" Then
        On Error Resume Next
        Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
        On Error Resume Next
        Set EmbedObj5 = AttachME.EMBEDOBJECT(1454, "", Attachment5, "Attachment")
        On Error Resume Next
        MailDoc.CREATERICHTEXTITEM ("Attachment")
        On Error Resume Next
    End If
Attachment6 = Range("i15")
    If Attachment6 <> "" Then
        On Error Resume Next
        Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
        On Error Resume Next
        Set EmbedObj6 = AttachME.EMBEDOBJECT(1454, "", Attachment6, "Attachment")
        On Error Resume Next
        MailDoc.CREATERICHTEXTITEM ("Attachment")
        On Error Resume Next
    End If
Attachment7 = Range("j15")
    If Attachment7 <> "" Then
        On Error Resume Next
        Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
        On Error Resume Next
        Set EmbedObj7 = AttachME.EMBEDOBJECT(1454, "", Attachment7, "Attachment")
        On Error Resume Next
        MailDoc.CREATERICHTEXTITEM ("Attachment")
        On Error Resume Next
    End If
Attachment8 = Range("k15")
    If Attachment8 <> "" Then
        On Error Resume Next
        Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
        On Error Resume Next
        Set EmbedObj8 = AttachME.EMBEDOBJECT(1454, "", Attachment8, "Attachment")
        On Error Resume Next
        MailDoc.CREATERICHTEXTITEM ("Attachment")
        On Error Resume Next
    End If
Attachment9 = Range("l15")
    If Attachment9 <> "" Then
        On Error Resume Next
        Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
        On Error Resume Next
        Set EmbedObj9 = AttachME.EMBEDOBJECT(1454, "", Attachment9, "Attachment")
        On Error Resume Next
        MailDoc.CREATERICHTEXTITEM ("Attachment")
        On Error Resume Next
    End If
Attachment10 = Range("m15")
    If Attachment10 <> "" Then
        On Error Resume Next
        Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
        On Error Resume Next
        Set EmbedObj10 = AttachME.EMBEDOBJECT(1454, "", Attachment10, "Attachment")
        On Error Resume Next
        MailDoc.CREATERICHTEXTITEM ("Attachment")
        On Error Resume Next
    End If
    MailDoc.PostedDate = Now()
    On Error GoTo errorhandler1
    MailDoc.SEND 0, Recipient
    Set Maildb = Nothing
    Set MailDoc = Nothing
    Set AttachME = Nothing
    Set Session = Nothing
    Set EmbedObj1 = Nothing
    Set EmbedObj2 = Nothing
    Set EmbedObj3 = Nothing
    Set EmbedObj4 = Nothing
    Set EmbedObj5 = Nothing
    Set EmbedObj6 = Nothing
    Set EmbedObj7 = Nothing
    Set EmbedObj8 = Nothing
    Set EmbedObj9 = Nothing
    Set EmbedObj10 = Nothing
    Exit Sub
errorhandler1:
    Application.Goto Reference:="IAddress"
    CellLocation99 = ActiveSheet.Name & "!" & ActiveCell.Address
    Worksheets("Address Complications").Select
    Range("a1").Select
    Selection.End(xlDown).Select
    ActiveCell.Offset(1, 0).Select
    ActiveCell = CellLocation99
    Set Maildb = Nothing
    Set MailDoc = Nothing
    Set AttachME = Nothing
    Set Session = Nothing
    Set EmbedObj1 = Nothing
    Set EmbedObj2 = Nothing
    Set EmbedObj3 = Nothing
    Set EmbedObj4 = Nothing
    Set EmbedObj5 = Nothing
    Set EmbedObj6 = Nothing
    Set EmbedObj7 = Nothing
    Set EmbedObj8 = Nothing
    Set EmbedObj9 = Nothing
    Set EmbedObj10 = Nothing
End Sub
The attachments are dos filepathsnames. I have a pretty good Excel workbook set up with some monster functionality. I could send the entire kit & kaboodle via e-mail if you shoot me an e-mail

Cheers,

Nate
NateO is offline   Reply With Quote
Old Feb 20th, 2002, 06:42 PM   #7
Ivan F Moala
MrExcel MVP
 
Ivan F Moala's Avatar
 
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
Default

Here is another way;

Option Explicit

Sub LotusNotes_Session()
Dim Subject As String
Dim Recipient As String
Dim Msg As String
Dim nSession As notesSession
Dim nDatabase As NotesDatabase
Dim nDoc As NOTESDOCUMENT
'Need to reference the Lotusnotes object library

Subject = "Test message from VBA"
Recipient = "me@here.com.nz"
Msg = "This is a message sent to myself from VBA." + _
vbNewLine + "blah"

'session and database declared in general as object
Set nSession = CreateObject("Notes.NotesSession") 'create notes session
Set nDatabase = nSession.GetDatabase("", "") 'set db to database not yet named
Call nDatabase.OPENMAIL 'Open the users mail database

Set nDoc = nDatabase.CREATEDOCUMENT 'create a new document in mail database
Call nDoc.replaceitemvalue("SendTo", Recipient) 'create sendto field
Call nDoc.replaceitemvalue("Subject", Subject) 'create subject field
Call nDoc.replaceitemvalue("Body", Msg) 'create body field
Call nDoc.SEND(False) 'send message

Set nSession = Nothing ' close connection to free memory

End Sub


'Notes from help file;
'Set nDatabase = nSession.GetDatabase( server$, dbfile$ [, createonfail ] )

'Parameters
'server$

'String. The name of the server on which the database resides.
'Use an empty string ("") to indicate a database on the current computer:
'if the script runs on the workstation, the empty string indicates a local database;
'if the script runs on a server, it indicates a database on that server.


'dbfile$

'String. The file name and location of the database within the Notes data directory.
'Use empty strings for both dbfile$ and server$ if you want to open the database later.
'Use a full path name if the database is not within the Notes data directory.


'createonfail

'Note This parameter is new with Release 5.

'Boolean. Optional. Specify True (default) to create the database if it does not exist.


'Return value
'NotesDatabase

'A NotesDatabase object that can be used to access the database you've specified.


'If a database exists at the server$ and dbfile$ specified,
'the NotesDatabase object is open, and the script can access all its properties and methods.

'If a database does not exist at the server$ and dbfile$ specified,
'the NotesDatabase object is closed. To create a new database at the
'specified location if one does not exist, specify True for createonfail.


'Ivan
Ivan F Moala is offline   Reply With Quote
Old Feb 20th, 2002, 06:53 PM   #8
brettvba
MrExcel MVP
 
Join Date: Feb 2002
Location: Christchurch New Zealand
Posts: 1,030
Default

Cheers fellas its hard to find many knowledgable fellas in little old NZ
much apprecited
brettvba is offline   Reply With Quote
Old Feb 20th, 2002, 07:12 PM   #9
NateO
Legend
 
NateO's Avatar
 
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
Default

Brett,

Looks like Ivan's your neighbor. And judging by the 'unlock the vba' code demonstrated a few days ago, the man has skills.

Back to the matter at hand. I personally prefer to type the message in a worksheet cell than in the VBE. This is because it's easier to enter hard returns and line-spaces in your message body (alt-enter and space-bar on blank lines) than in the VBE (using chr(13)[s], etc....). Just throw that out there in terms of user-ability.

Nice work Ivan, good hunting Brett.

Cheers,

Nate

[ This Message was edited by: NateO on 2002-02-20 18:19 ]
NateO is offline   Reply With Quote
Old Feb 20th, 2002, 07:20 PM   #10
brettvba
MrExcel MVP
 
Join Date: Feb 2002
Location: Christchurch New Zealand
Posts: 1,030
Default

With your particular one Nate how to you send to say 10 or 15 ppl in the "To" Field
??
brettvba is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 02:26 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes