Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 684
  • Last Modified:

invoke lotus notes application from VB

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
shuping
Asked:
shuping
  • 9
  • 7
1 Solution
 
ghassan99Commented:
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
 
shupingAuthor Commented:
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
 
shupingAuthor Commented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
shupingAuthor Commented:
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
 
shupingAuthor Commented:
The redbook you recommended is very helpful

Thank you
0
 
ghassan99Commented:
Good, will that earn me the points?
0
 
ghassan99Commented:
u dont have to use DDE, its not advisable
0
 
ghassan99Commented:
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
 
shupingAuthor Commented:
The last sample code you provide to me is helpful.
Thank you


Shuping
0
 
shupingAuthor Commented:
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
 
ghassan99Commented:
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
 
shupingAuthor Commented:
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
 
ghassan99Commented:
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
 
shupingAuthor Commented:
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
 
ghassan99Commented:
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
 
shupingAuthor Commented:
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 9
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now