Hi everybody.
I get error "Run 91" - Object Variable or With Block Variable Not Set when i try to send an email with Lotus Notes, using an Excel Userform.
Here's my code:
Sub LotusMail_Click() Dim NSession As Object Dim NUIWorkSpace As Object Dim NDoc As Object Dim NUIdoc As Object Dim Maildb As Object ' The mail database Dim UserName As String 'The users notes name Dim MailDbName As String ' The users notes mail database name cbxOnTop.Value = False Select Case MsgBox("blablabl", vbOKCancel Or vbQuestion Or vbDefaultButton1, "aaa") Case vbOK Application.WindowState = xlMaximized Windows("ORDINI DHL.xls").Activate Sheets("1").Select Range("a1").Select cbxOnTop.Value = True Set NSession = CreateObject("Notes.NotesSession") UserName = NSession.UserName MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf" 'Open the mail database in notes Set Maildb = NSession.GETDATABASE("", "") If Maildb.IsOpen = True Then 'Already open for mail Else Maildb.OpenMail End If Set NUIWorkSpace = CreateObject("Notes.NotesUIWorkspace") Set NDoc = NUIWorkSpace.ComposeDocument("", "", "Memo") Set NUIdoc = NUIWorkSpace.CURRENTDOCUMENT With NUIdoc .FieldSetText "EnterCopyTo", "" <------ .FieldSetText "Subject", "Hello " .FieldSetText "Body", "" & Me.txtPappa.Value & Me.txtPip.Value .GotoField ("Body") .FieldSetText "EnterSendTo", "me@hotmail.com" Application.CutCopyMode = False .send .Close End With Set NUIdoc = Nothing Set NDoc = Nothing Set NUIWorkSpace = Nothing Set NSession = Nothing End Sub
Everytime i try to send an email, the error focuses on the first .FieldSetText.
I really hope you could help me.
Thanks a lot.
Last edited by TMShucks; 01-10-2012 at 02:23 PM.
Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
Please leave a message after the beep!
I think you need an "End Select" before the End Sub.
Difficult to test with no workbook (and no Lotus Notes)
Please note that:
Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
However, on this occasion, I have corrected this for you.
Regards, TMS
@Mordred: sorry! I was in the process of "fixing and answering" for the new user. Didn't mean to tread on your toes![]()
Sorry guys! Next i will surely use the tags.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks