Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

invoke lotus notes application from VB

Posted on 1999-07-02
16
Medium Priority
?
682 Views
Last Modified: 2013-12-18
I want to invoke the lotos notes application and execute the lotus notes command to start a new message application.
I do not know how to link the lotus notes
0
Comment
Question by:shuping
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 7
16 Comments
 
LVL 6

Expert Comment

by:ghassan99
ID: 1119702
To link to Lotus Notes, u must use the Lotus Notes Automation Classes in VB.  When u create a Lotus Notes application in VB, u must reference notes32.tlb.  There is a very good free book in www.lotus.com/redbooks called 'Lotus Script for Visual Basic Programmers' It discusses this issue.  Basically what u can do to initialize a notes session is that:

Dim session As NOTESSESSION
Dim db As NOTESDATABASE
Dim view As NOTESVIEW
Dim doc As NOTESDOCUMENT

Set session = CreateObject("Notes.NotesSession")
Set db = session.GETDATABASE("", "test.nsf") 'name of ur application
Set view = db.GETVIEW("test") 'name of a view inside ur application
Set doc = view.GETFIRSTDOCUMENT 'gets the first doc in that view

All type of objects use the same properties and methods as in notes, u can check the object browser in VB to see all objects and their relevant methods and properties, and u can check the help in Notes. Its really simple and fun. u cant use the @commands of Notes in VB.

0
 

Author Comment

by:shuping
ID: 1119703
I got the error message from running the above recommended code.  message is " Database shuping han has not yet opened"
I tried to open my e-mail database which need password to open. would you please tell me how I can open this database.
By the way you mentioned that I cannot use the lotus notes @command in VB. would you please tell me how I can execute the lotus notes command after creating the object.

What I want to do is:

run VB programm to open lotus notes application new memo and attach the letter which is written in Word. With the recepient's name, address added automatically and default subject text is also added to subject field.
0
 

Author Comment

by:shuping
ID: 1119704
I got the error message from running the above recommended code.  message is " Database shuping han has not yet opened"
I tried to open my e-mail database which need password to open. would you please tell me how I can open this database.
By the way you mentioned that I cannot use the lotus notes @command in VB. would you please tell me how I can execute the lotus notes command after creating the object.

What I want to do is:

run VB programm to open lotus notes application new memo and attach the letter which is written in Word. With the recepient's name, address added automatically and default subject text is also added to subject field.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:shuping
ID: 1119705
Hi,
Could anyone tell me how to use shell(), linktopic, linkitem, linkmode to link lotus notes application.

I want to do following:

by running a VB executable, user can open the lotus notes application new memo, passing the e-mail address from address book and attach word document to the new memo. subject field should get default value. All this should be done when user press a button on the VB form.


Shuping
0
 

Author Comment

by:shuping
ID: 1119706
The redbook you recommended is very helpful

Thank you
0
 
LVL 6

Accepted Solution

by:
ghassan99 earned 600 total points
ID: 1119707
Good, will that earn me the points?
0
 
LVL 6

Expert Comment

by:ghassan99
ID: 1119708
u dont have to use DDE, its not advisable
0
 
LVL 6

Expert Comment

by:ghassan99
ID: 1119709
Here is a simple code to do that:

Private Sub Command1_Click()

   Dim session As Object
   Dim db As Object
   Dim doc As Object
   Dim rtf As Object
   Dim nt As Object

   Set session = CreateObject("Notes.NotesSession")
   Set db = session.GETDATABASE("", "mail\gus.nsf")
   Set doc = db.CREATEDOCUMENT
   doc.Form = "Memo"
   doc.SendTo = "Paul Rony"
   doc.Subject = "New Memo"
   Set rtf = doc.CREATERICHTEXTITEM("Body")
   Call rtf.APPENDTEXT("Anything Goes!")
   Call rtf.ADDNEWLINE(2)
   Call rtf.EMBEDOBJECT(1454, "", "c:\loc.txt") 'use the same parameters except the filename
   Call doc.Send(False)
   Set doc = Nothing
   Set db = Nothing
   Set session = Nothing
End Sub


0
 

Author Comment

by:shuping
ID: 1119710
The last sample code you provide to me is helpful.
Thank you


Shuping
0
 

Author Comment

by:shuping
ID: 1119711
Hi ghassan99,
This simple sample code did work well. However, if I want to review/check before I send out the mail, I am unable to stop. I have tried to find the possiblitity. Unfortunately, I did not fine out.
Would you please give me some comments

Shuping
Private Sub Command1_Click()

   Dim session As Object
   Dim db As Object
   Dim doc As Object
   Dim rtf As Object
   Dim nt As Object

   Set session = CreateObject("Notes.NotesSession")
   Set db = session.GETDATABASE("", "mail\gus.nsf")
   Set doc = db.CREATEDOCUMENT
   doc.Form = "Memo"
   doc.SendTo = "Paul Rony"
   doc.Subject = "New Memo"
   Set rtf = doc.CREATERICHTEXTITEM("Body")
   Call rtf.APPENDTEXT("Anything Goes!")
   Call rtf.ADDNEWLINE(2)
   Call rtf.EMBEDOBJECT(1454, "", "c:\loc.txt") 'use the same parameters except the filename
   Call doc.Send(False)
   Set doc = Nothing
   Set db = Nothing
   Set session = Nothing
End Sub

0
 
LVL 6

Expert Comment

by:ghassan99
ID: 1119712
What do u mean?
This function handles the sending:
Call doc.Send(False)
u can precede this with a msgbox to show u what will be sent...and if confirmed u can continue to the Call doc.Send(False)  else exit the sub
0
 

Author Comment

by:shuping
ID: 1119713
Hi ghassan99,

Thanks for your rapid responce and sharing your knoweldge with me. The question is that I want to see the "memo"'s send page  with the attached file ane then press send button instead of sending directly without notising anything. At that point the user can enter the recipient e-mail.

Thank you

Shuping
0
 
LVL 6

Expert Comment

by:ghassan99
ID: 1119714
Create a form in VB and add text fields for recepients email and body field and just substitue those inside the formulas...like
  doc.SendTo = "Paul Rony"  becomes   doc.SendTo = txtRecepient.text
Then u can add a command button on the VB form which only sends the memo. name the command button 'Send' and put inside it the above code after u modify it.
0
 

Author Comment

by:shuping
ID: 1119715
Hi ghassan99,

Thanks very much for your quick response. What you suggested is not bad idea. I also considered the similar features as u recommended. However, I want the user to stop at the lotus notes new memo and select the recipients e-mail from lotus notes address database. Could you give me some suggestion.

Thank you very much

Shuping

0
 
LVL 6

Expert Comment

by:ghassan99
ID: 1119716
Anyway, I think when u start this program in the first place Notes should be open...I suggest u remove the doc.send command and switch to Notes (while ur VB program is running) u will see it open with the new memo
0
 

Author Comment

by:shuping
ID: 1119717
Hi ghassan99,

If I remove the doc.send then the notes new memo never opened, even the notes login window can not prompt.


Shuping
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

671 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question