Solved

Second tracer letter in one button

Posted on 2008-09-29
6
173 Views
Last Modified: 2013-12-18
How would I need to modify the code below to allow for a second letter to got out. I will be pulling from the same form, but it will be sending different field values and it will be going to a different user group. Trying to get this one button to send both newsletter style messages.
Sub Click(Source As Button)

	Dim s As New NotesSession

	Dim w As New NotesUIWorkspace

	Dim db As NotesDatabase

	Dim v As NotesView

	Dim c As NotesDocumentCollection

	Dim doc As NotesDocument

	Dim key As String

	Dim cur As NotesDocument

	Set db = s.CurrentDatabase

	Set doc = w.CurrentDocument.Document

	key = doc.ussales(0)    'get the name of office (view category) from the current document

	Set v = db.GetView( "newsletter" ) 'maybe you'll have to create the view that is categorized by office

	Set c = v.GetAllDocumentsByKey( key, True )

	Dim newDoc As New NotesDocument( db )

	Dim rt As NotesRichTextItem

	Set rt = newDoc.CreateRichTextItem( "Body" )

	Dim rtsHeader As NotesRichTextStyle, rtsNormal As NotesRichTextStyle

	Set rtsHeader = s.CreateRichTextStyle  

	Set rtsNormal = s.CreateRichTextStyle

	

	rtsHeader.NotesFont = FONT_COURIER   'it's fixed size font, good for tabbed tables

	rtsHeader.FontSize = 12

	rtsHeader.Bold = True

	

	rtsNormal.NotesFont = FONT_COURIER

	rtsNormal.FontSize = 10

	rtsNormal.Bold = False

	

	Call rt.AppendStyle( rtsHeader )

	

	Call rt.AddNewLine( 3 )

	Call rt.AppendText( "Employee #" )

	Call rt.AddTab( 1 )

	Call rt.AppendText( "Current Asset" )

	Call rt.AddTab( 2 )

	Call rt.AppendText( "New Asset " )

	Call rt.AddTab( 2 )

	Call rt.AppendText( "Current Mon Asset" )

	Call rt.AddTab( 2 )

	Call rt.AppendText( "New  Mon Asset" )

	Call rt.AddNewLine( 1 )

	

	Call rt.AppendStyle( rtsNormal )     'The style that would be applied on text bellow header

	

	Set cur = c.GetFirstDocument

	Do Until cur Is Nothing

		Call rt.AddNewLine( 1 )

		Call rt.AppendText( cur.emp_num(0) )

		Call rt.AddTab( 2 )

		Call rt.AppendText( cur.current_asset(0) )

		Call rt.AddTab( 2 )

		Call rt.AppendText( cur.new_asset(0) )

		Call rt.AddTab( 1 )

		Call rt.AppendText( cur.current_mon_asset(0) )

		Call rt.AddTab( 3 )

		Call rt.AppendText( cur.new_mon_asset(0) )

		Call rt.AddTab( 2 )

		Call rt.AppendDocLink( cur, "Link to document " )  'add link to doc to the end

		

		Set cur = c.GetNextDocument( cur )

	Loop

	newDoc.Form = "Memo"

	newDoc.Subject = "IBPC Refresh DLM Update"' + cur.office_num_adjusted

	Call newDoc.Save( True, True )

	Call newDoc.Send( True, "Field Technology" )

	

	

End Sub

Open in new window

0
Comment
Question by:jforget1
  • 3
  • 3
6 Comments
 
LVL 63

Accepted Solution

by:
SysExpert earned 500 total points
ID: 22597045
this section needs to be copied and changed . It goes jus before the End Sub

It will send out another doc, but you need to change the parameters for what data and people it is going to

        Dim newDoc As New NotesDocument( db )
        Dim rt As NotesRichTextItem
        Set rt = newDoc.CreateRichTextItem( "Body" )
        Dim rtsHeader As NotesRichTextStyle, rtsNormal As NotesRichTextStyle
        Set rtsHeader = s.CreateRichTextStyle  
        Set rtsNormal = s.CreateRichTextStyle
       
        rtsHeader.NotesFont = FONT_COURIER   'it's fixed size font, good for tabbed tables
        rtsHeader.FontSize = 12
        rtsHeader.Bold = True
       
        rtsNormal.NotesFont = FONT_COURIER
        rtsNormal.FontSize = 10
        rtsNormal.Bold = False
       
        Call rt.AppendStyle( rtsHeader )
       
        Call rt.AddNewLine( 3 )
        Call rt.AppendText( "Employee #" )
        Call rt.AddTab( 1 )
        Call rt.AppendText( "Current Asset" )
        Call rt.AddTab( 2 )
        Call rt.AppendText( "New Asset " )
        Call rt.AddTab( 2 )
        Call rt.AppendText( "Current Mon Asset" )
        Call rt.AddTab( 2 )
        Call rt.AppendText( "New  Mon Asset" )
        Call rt.AddNewLine( 1 )
       
        Call rt.AppendStyle( rtsNormal )     'The style that would be applied on text bellow header
       
        Set cur = c.GetFirstDocument
        Do Until cur Is Nothing
                Call rt.AddNewLine( 1 )
                Call rt.AppendText( cur.emp_num(0) )
                Call rt.AddTab( 2 )
                Call rt.AppendText( cur.current_asset(0) )
                Call rt.AddTab( 2 )
                Call rt.AppendText( cur.new_asset(0) )
                Call rt.AddTab( 1 )
                Call rt.AppendText( cur.current_mon_asset(0) )
                Call rt.AddTab( 3 )
                Call rt.AppendText( cur.new_mon_asset(0) )
                Call rt.AddTab( 2 )
                Call rt.AppendDocLink( cur, "Link to document " )  'add link to doc to the end
               
                Set cur = c.GetNextDocument( cur )
        Loop
        newDoc.Form = "Memo"
        newDoc.Subject = "IBPC Refresh DLM Update"' + cur.office_num_adjusted
        Call newDoc.Save( True, True )
        Call newDoc.Send( True, "Field Technology" )
       

I hope this helps !
0
 

Author Comment

by:jforget1
ID: 22597100
Do I need to append any of the items with say a "2" so there is not a conflict with the first letter which goes out?
0
 

Author Comment

by:jforget1
ID: 22599054
Have been playing around with this and have it close. The only issue is how do I adjust the "Body" for the second email, it initially told me body was already declared, but changing it to Body2 produced a black email.
Sub Click(Source As Button)

	Dim s As New NotesSession

	Dim w As New NotesUIWorkspace

	Dim db As NotesDatabase

	Dim v As NotesView

	Dim c As NotesDocumentCollection

	Dim doc As NotesDocument

	Dim key As String

	Dim cur As NotesDocument

	Set db = s.CurrentDatabase

	Set doc = w.CurrentDocument.Document

	key = doc.ussales(0)    'get the name of office (view category) from the current document

	Set v = db.GetView( "newsletter" ) 'maybe you'll have to create the view that is categorized by office

	Set c = v.GetAllDocumentsByKey( key, True )

	Dim newDoc As New NotesDocument( db )

	Dim rt As NotesRichTextItem

	Set rt = newDoc.CreateRichTextItem( "Body" )

	Dim rtsHeader As NotesRichTextStyle, rtsNormal As NotesRichTextStyle

	Set rtsHeader = s.CreateRichTextStyle  

	Set rtsNormal = s.CreateRichTextStyle

	

	rtsHeader.NotesFont = FONT_COURIER   'it's fixed size font, good for tabbed tables

	rtsHeader.FontSize = 12

	rtsHeader.Bold = True

	

	rtsNormal.NotesFont = FONT_COURIER

	rtsNormal.FontSize = 10

	rtsNormal.Bold = False

	

	Call rt.AppendStyle( rtsHeader )

	

	Call rt.AddNewLine( 3 )

	Call rt.AppendText( "Employee #" )

	Call rt.AddTab( 1 )

	Call rt.AppendText( "Current Asset" )

	Call rt.AddTab( 2 )

	Call rt.AppendText( "New Asset " )

	Call rt.AddTab( 2 )

	Call rt.AppendText( "Current Mon Asset" )

	Call rt.AddTab( 2 )

	Call rt.AppendText( "New  Mon Asset" )

	Call rt.AddNewLine( 1 )

	

	Call rt.AppendStyle( rtsNormal )     'The style that would be applied on text bellow header

	

	Set cur = c.GetFirstDocument

	Do Until cur Is Nothing

		Call rt.AddNewLine( 1 )

		Call rt.AppendText( cur.emp_num(0) )

		Call rt.AddTab( 2 )

		Call rt.AppendText( cur.current_asset(0) )

		Call rt.AddTab( 2 )

		Call rt.AppendText( cur.new_asset(0) )

		Call rt.AddTab( 1 )

		Call rt.AppendText( cur.current_mon_asset(0) )

		Call rt.AddTab( 3 )

		Call rt.AppendText( cur.new_mon_asset(0) )

		Call rt.AddTab( 2 )

		Call rt.AppendDocLink( cur, "Link to document " )  'add link to doc to the end

		

		Set cur = c.GetNextDocument( cur )

	Loop

	newDoc.Form = "Memo"

	newDoc.Subject = "IBPC Refresh DLM Update"' + cur.office_num_adjusted

	Call newDoc.Save( True, True )

	Call newDoc.Send( True, "Field Technology" )

	

	

	Dim newDoc2 As New NotesDocument( db )

	Dim rt2 As NotesRichTextItem

	Set rt2 = newDoc.CreateRichTextItem( "Body2" )

	Dim rtsHeader2 As NotesRichTextStyle,  rtsNormal2 As NotesRichTextStyle

	Set rtsHeader2 = s.CreateRichTextStyle  

	Set rtsNormal2 = s.CreateRichTextStyle

	

	rtsHeader2.NotesFont = FONT_COURIER   'it's fixed size font, good for tabbed tables

	rtsHeader2.FontSize = 12

	rtsHeader2.Bold = True

	

	rtsNormal2.NotesFont = FONT_COURIER

	rtsNormal2.FontSize = 10

	rtsNormal2.Bold = False

	

	Call rt2.AppendStyle( rtsHeader2 )

	

	Call rt2.AddNewLine( 3 )

	Call rt2.AppendText( "Employee #" )

	Call rt2.AddTab( 1 )

	Call rt2.AppendText( "Current Asset" )

	Call rt2.AddTab( 2 )

	Call rt2.AppendText( "New Asset " )

	Call rt2.AddTab( 2 )

	

	Call rt2.AppendStyle( rtsNormal )     'The style that would be applied on text bellow header

	

	Set cur = c.GetFirstDocument

	Do Until cur Is Nothing

		Call rt2.AddNewLine( 1 )

		Call rt2.AppendText( cur.emp_num(0) )

		Call rt2.AddTab( 2 )

		Call rt2.AppendText( cur.current_asset(0) )

		Call rt2.AddTab( 2 )

		Call rt2.AppendText( cur.new_asset(0) )

		Call rt2.AddTab( 1 )

		Call rt2.AppendDocLink( cur, "Link to document " )  'add link to doc to the end

		

		Set cur = c.GetNextDocument( cur )

	Loop

	newDoc2.Form = "Memo"

	newDoc2.Subject = "IBPC Refresh DLM Update 2"' + cur.office_num_adjusted

	Call newDoc2.Save( True, True )

	Call newDoc2.Send( True, "Joseph R Forget/Bsg/MetLife/US@MetLife" )

	

End Sub

Open in new window

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 63

Expert Comment

by:SysExpert
ID: 22602739
Set rt2 = newDoc.CreateRichTextItem( "Body2" )


needs to be

Set rt2 = newDoc2.CreateRichTextItem( "Body2" )
0
 
LVL 63

Expert Comment

by:SysExpert
ID: 22602740
Set rt2 = newDoc.CreateRichTextItem( "Body2" )


needs to be

Set rt2 = newDoc2.CreateRichTextItem( "Body2" )
0
 

Author Comment

by:jforget1
ID: 22604965
Thanks for the help here.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Lotus Notes 8.5 1 140
How can I make DNS resolve different addresses dependant on location? 2 162
Find and delete local contacts in names.nsf 5 178
@Mailsend 3 38
I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

929 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now