6098 comments
2357 subscribers
6263 on Twitter
Subscribe! Feed reader E-mail

On this page:

Analyzing my Lotus Notes sent mail since January 2011

Today is my penultimate day at IBM! Having successfully turned my projects over to another developer (hooray for the habit of organizing project-related files in Lotus Connections Activities), I’ve been focusing on getting things ready for the traditional goodbye e-mail, which I plan to send tomorrow.

I dug around in the Lotus Connections Profiles API to see if I could get a list of my contacts’ e-mail addresses. I fixed a small bug in the feed exporter of the Community Toolkit (w4.ibm.com/community for people in the IBM intranet) and exported my contacts, giving me a list of 530 IBMers who had accepted or sent me an invitation to connect.

Not everyone participates in that Web 2.0 network, though, so I wanted to analyze my sent mail to identify other people to whom I should send a note. I couldn’t find a neat LotusScript to do the job, and I couldn’t get the NSF to EML or mbox converter to work. Because I didn’t need all the information, just the recipients, subjects, and times, I wrote my own script (included at the end of this blog post).

I used the script to summarize the messages in my sent mail folder, and crunched the numbers using PivotTables in Microsoft Excel. I worked with monthly batches so that it was easier to find and fix errors. I decided to analyze all the mail going back to the beginning of last year in order to identify the people I mailed the most frequently, and to come up with some easy statistics as well.

image

Spiky around project starts/ends, I’d guess.

image

I wanted to see which roles I tended to e-mail often, so I categorized each recipient with their role. I distinguished between people I’d worked with directly on projects (coworkers) and people who worked with IBM but with whom I didn’t work on a project (colleagues). The numbers below count individual recipients.

Role

Number of people

Number of individual
e-mails sent

Average e-mails sent
per person

colleague 407 827 2.0
coworker 50 562 11.2
client 21 387 18.4
manager 4 109 27.3
partner 9 51 5.7
system 9 21 2.3
other 8 11 1.4
self 1 5 5.0
Grand Total 509 1973 3.9

As it turns out, I sent a lot of mail to a lot of people throughout IBM, mostly in response to questions about Lotus Connections, Idea Labs, or collaboration tools.

Now I can sort my summarized data to see whom I e-mailed the most often, and add more names to my don’t-forget-to-say-goodbye list. If all goes well, I might even be able to use that mail merge script. =)

The following agent processes selected messages and creates a table with one row per recipient, e-mailing the results to the specified mail address. It seems to choke on calendar entries and other weird documents, but if you go through your sent mail box in batches (Search This View by date is handy), then you should be able to find and delete the offending entries.

Option Public
Dim TempNitem As NotesItem
Dim TempNm As NotesName
Dim session As  NotesSession
Dim db As NotesDatabase
Sub Initialize
	mailAddress = "YOUR_ADDRESS@HERE"
	
	Dim ws As New NotesUIWorkspace
	Dim uidoc As NotesUIDocument
	Dim partno As String
	Dim db As NotesDatabase
	Dim view As NotesView
	Dim doc As NotesDocument
	Dim collection As NotesDocumentCollection
	Dim memo As NotesDocument
	Dim body As NotesRichTextItem
	Dim range As NotesRichTextRange
	Dim count As Integer
	
	Set session = New NotesSession
	Set db = session.CurrentDatabase
	Set collection = db.UnprocessedDocuments
	
	Dim FldTitles(3) As String
	FldTitles(0) = "E-mail"
	FldTitles(1) = "Subject"
	FldTitles(2) = "Date sent"
	
	Set maildoc = db.CreateDocument
	maildoc.Form = "Memo"
	maildoc.Subject = "Summary"
	maildoc.SendTo = mailAddress
	Dim ritem As NotesRichTextItem
	Set ritem=New NotesRichTextItem(maildoc,"body") 
' passing the rich text item & other relevant details
	Set ritem = CreateTable(FldTitles, collection, ritem, "Sent items", "Summary created on " + Format(Now, "YYYY-MM-DD"))
	maildoc.send(False)
End Sub
Function CreateTable(FldTitles As Variant, doccoll  As NotesDocumentCollection, rtitem As NotesRichTextItem,msgTitle As String,msgBody As String ) As NotesRichTextItem
	'http://searchdomino.techtarget.com/tip/0,289483,sid4_gci1254682_mem1,00.html
	'Takes  Documentcollection & creates tabular information on to the passed   rtitem (rich text item)
	
	Set ritem=rtitem
	Set rtnav = ritem.CreateNavigator
	Set rstyle=session.CreateRichTextStyle 
	
	'===================================================
	'heading in the body section of the mail
	rstyle.Bold=True
	rstyle.NotesColor=COLOR_RED 
	rstyle.Underline=True
	rstyle.NotesFont=FONT_COURIER
	rstyle.FontSize=12
	Call  ritem.AppendStyle(rstyle)
	ritem.AppendText(msgTitle)
	
	rstyle.Underline=False
	rstyle.NotesColor=COLOR_BLACK
	ritem.AddNewline(2)
	
	rstyle.FontSize=10
	rstyle.Bold=False
	rstyle.NotesColor=COLOR_BLACK
	Call  ritem.AppendStyle(rstyle) 
	ritem.AppendText(msgBody)
	ritem.AddNewline(1)
	
	'===================================================
	rows=doccoll.Count +1
	cols=CInt(UBound(FldTitles)) 
	
	Call ritem.AppendTable(1, cols)
	Dim rtt As NotesRichTextTable
	Call rtnav.FindFirstElement(RTELEM_TYPE_TABLE)
	Set rtt = rtNav.GetElement 
	'=================================================
	'heading of the table
	rstyle.Bold=True
	rstyle.NotesColor=COLOR_BLUE 
	rstyle.FontSize=10
	Call  ritem.AppendStyle(rstyle)
	
	For i=0 To UBound(FldTitles) - 1
		Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
		Call ritem.BeginInsert(rtnav) 
		Call ritem.AppendText(FldTitles(i))
		Call ritem.EndInsert
	Next
	
	'=================================================
	rstyle.FontSize=10
	rstyle.Bold=False
	rstyle.NotesColor=COLOR_BLACK
	Call  ritem.AppendStyle(rstyle)
	Dim count As Integer
	count = 0
	Set  doc=doccoll.GetFirstDocument
	While Not (doc Is Nothing)
		subject = doc.GetFirstItem("Subject").values(0)
		posted = doc.GetFirstItem("PostedDate").values(0)
		Set sendTo = doc.getFirstItem("SendTo")
		For i = 0 To UBound(sendTo.values)
			Call rtt.AddRow(1)
			Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)   
			Call ritem.BeginInsert(rtnav)
			ritem.appendText(sendTo.values(i))
			Call ritem.EndInsert
			Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)   
			Call ritem.BeginInsert(rtnav)
			ritem.appendText(subject)
			Call ritem.EndInsert
			Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)   
			Call ritem.BeginInsert(rtnav)
			ritem.appendText(posted)
			Call ritem.EndInsert
		Next   
		count = count + 1
		Set doc=doccoll.GetNextDocument(doc)
	Wend
	Set CreateTable=ritem
	MsgBox "E-mails summarized: " & count	
End Function

I find it helpful to save it as the "Summarize Recipients" agent and assign it to a toolbar button that runs @Command([RunAgent]; "Summarize Recipients").

Short URL: http://sachachua.com/blog/p/23164

Lotusphere 2011 wrap-up

This was my first Lotusphere, and it was a blast. Lotus has such an active, passionate, experienced community around it. Heading to the conference, my goals were:

  • [X] Learn more about Lotus Connections adoption and APIs
  • [X] Learn about IBM’s strategy and innovations
  • [X] Get a sense of the ecosystem around Lotus (partners, clients, etc.)
  • [X] Meet people and make personal connections
  • [X] Brainstorm and share insights
  • [X] Show my appreciation for the cool work people do
  • [X] Learn more about conferences and presentations
  • [X] Fulfill my room monitor responsibilities

Here’s what I took away from the sessions and BoFs I attended:

Clients are interested in collaboration and have lots of adoption insights. We’re starting to see interesting case studies from clients. In addition to reporting excellent returns on their investments, clients shared qualitative feedback, such as stories of pilot groups who couldn’t imagine giving up the tools. Successful clients used executive support, communication plans, mentoring, metrics, incentives, role models, and other techniques to help people make new forms of collaboration part of the way people worked. sketchnotes from the birds-of-a-feather session on adoption

LotusLive is awesome. LotusLive currently includes web conferencing and parts of Lotus Connections. LotusLive Labs includes a technical preview of LotusLive Symphony (collaborative document/spreadsheet editing), Slide Library, and Event Maps. (I wish I’d seen Event Maps when I was planning my Lotusphere attendance!) Granted, Google Docs has been around for longer than LotusLive Symphony, but I’m curious about the ability to assign sections for editing or review.

Activity streams and embedded experiences are going to change the inbox. I don’t know when this is going to go into people’s everyday lives, but the idea of being able to act on items right from the notifications will be pretty cool – whether it’s in an enriched mail client like Lotus Notes or a web-based activity stream that might be filtered by different attention management algorithms. It’ll be interesting to figure out the security implications of this, though. It’s already a bad practice to click on links in e-mail right now, so full embedded transactions might encounter resistance or might open up new phishing holes. Project Vulcan is worth watching.

People are already doing interesting things with the Lotus Connections API. Embedding Lotus Connections content / interactions into other websites, adding more information to Lotus Connections, using different authentication mechanisms… people are rocking the API. The compliance API that’s coming soon will help people do even more with Lotus Connections interactions, too.

The next version of Lotus Connections will be even cooler. I’m particularly excited about the idea blogs and the forum improvements, which seem tailor-made for the kind of collective virtual brainstorming we’ve been doing in Idea Labs. Idea blogs are straightforward – a blog post or question with comments that can be voted up or down – but they’ll go a long way to enabling new use cases. Forums will also have question/answer/best answer support.

Sametime Unified Telephony rocks. I need to find out how to get into that. I like click-to-call ringing everyone’s preferred devices, easy teleconferences, and rules for determining phone forwarding.

Lotus Notes and Domino are getting even more powerful. XPages looks pretty cool. I’ll leave the rest of the commentary on this to other bloggers, as my work doesn’t focus enough on Lotus Notes and Domino for me to be able to give justice to the improvements.

The Lotus ecosystem is doing well. Lots of activity and investment from partners and clients.

Analytics + research = opportunity. Interesting research into attention management, activity streams, social network analysis.

Lotus geeks are a world of their own. It’s amazing to spend time with people who have immersed themselves deeply in a technology platform for almost two decades. There’s a depth and richness here that I don’t often find at technology conferences. There’s also a lot of tough love – people like IBM, and they’re not afraid to call us out if we’re not clear or if we seem to be making mistakes. =)

Notes from conversations

The hallway track (those informal encounters and chance connections) resulted in great conversations. For me, the highlights were:

  • Being adopted by various groups – so helpful for this Lotusphere newbie! Special thanks to @alex_zzz>, @belgort, @billmachisky, @branderson3, @ericmack, and @notesgoddess for bringing me into fascinating conversations.
  • Andy Schirmer walking me through his task spreadsheet with eight years of task data summarized in some very cool graphs. I want to have data like that.
  • Talking to Hiro about crowdsourcing and sharing the cool things we’ve been doing with Idea Labs.
  • Seeing all these people I met online. Finally getting to meet Tessa Lau, Bruce Elgort, Julian Robichaux, Mitch Cohen, and other folks, too! It’s great to be able to connect with people on a personal level, thanks to blog posts and Twitter. (How do people manage to keep up to date and remember all of this stuff? I felt all warm and fuzzy when people congratulated me on the recent wedding, and I wished I remembered more tidbits about them. Working on that!)
  • Being reminded by David Brooks and other early adopters that I’ve been around from the beginning of Lotus Connections. (Okay, David did that in a BoF.) It seems Lotus Connections has always been around. <laugh>
  • Joining the geek trivia challenge. The questions about television and comics went way over my head, but it was good to spend time with other folks, and I had so much fun. Well worth needing to figure out how to get back to the Port Orleans hotel after the conference shuttle service ended.
  • Talking to Jeanne Murray and Rawn Shah about a personal maturity model for social business. Some ideas: control of recipients, trust, transparency, conflict resolution techniques, asymmetric knowledge of others, persona separation/integration, acceptance of change; overlap with leadership maturity models; context dependency of decisions…
  • Talking to Bonnie John about the politics of writing about process improvement. Interesting thing to untangle. More thinking needed.
  • Swapping tips on Gen Y life with Julie Brown, Alexander Noble (@alex_zzz>), Brandon Anderson (@branderson3), and others

If I get to attend Lotusphere again, I’d love to be able to stay at the conference hotel. It would be much more convenient and I’d be able to go to more of the evening get-togethers. The chances of my being able to attend again probably depend on how much of the Social Business adoption consulting we’ll get to do over the next year, and I hope we do a lot. I’d also make time to check out the showcase. I missed it this year, thanks to all that chatting.

Next actions for me

For work, I’ll probably focus on external Web 2.0 / social media site development while other groups figure out the structure for social business adoption consulting. I’m looking forward to learning from the case studies, insights, and questions that people have shared, though, and I’d love to do more work in this section.

Here’s what I need to do for post-conference wrap-up:

  • [X] Go through my index cards and write additional notes
  • [X] Contact people I met and follow up on conversations
  • [X] Catch up with work mail
  • [X] Catch up with personal mail
  • [X] Write further reflections
    • [X] Time analysis
    • [X] Appearance and bias
    • [X] IBM and women in technology
    • [X] Reflections on careers, loyalty, story, and alternatives
    • [X] Presentation reflections (time for questions, presentation style, rapport, morning sessions?)
  • [X] Plan my next steps

Other Lotusphere 2011 wrap-ups you might like: Chris Connor, David Greenstein, Luis Benitez (Day 1, Day 2, Day 3, Day 4, Day 5), Andy Donaldson, Marc Champoux (… where are the female bloggers’ writeups?)

See also: Lotusphere social aggregator, Planet Lotus, Twitter search for #ls11, Twitter/blog archive

2011-02-04 Fri 16:04

Short URL: http://sachachua.com/blog/p/22074

Lotus Notes mail practices

Here is a partial list of interesting practices I’ve seen, which I can compile into an internal or external wiki if I don’t come across an existing repository yet:

  • Voting buttons in newsletters to allow people to rate the usefulness
  • Subscription button in newsletters to allow people who received forwarded messages to be added to the distribution list
  • Calendar buttons
  • Forms/surveys
  • RSVP+calendar entry buttons in event invitations – creating non-blocking entries if necessary
  • Calendar button for scheduling replays if you can’t make it to the original event
  • Using sections to hide material (note: manually configure section properties so that sections are collapsed by default, but automatically expanded for printing)
  • Voting/volunteering buttons
  • Response summarization agents
  • Mail merge
  • Stationery
  • Standard response documents
  • Introductory sentence explaining why people are getting mail
  • Reply button with template
Short URL: http://sachachua.com/blog/p/7696

Sample code for allowing drag-and-drop of Notes/Domino documents (including email) to a table in a plugin

Because I had to piece this together from examples on the Internet, and probably other people do too:

Transfer[] transferArray = new Transfer[]{
    XMLTransfer.getInstance(),
};
tableViewer.addDropSupport(DND.DROP_DEFAULT | DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK,
    transferArray, new DropTargetAdapter() {
        public void drop(DropTargetEvent event) {
            TableItem item = (TableItem) event.item;
            // You can access the object with item.getData()
            try {
                NotesThread.sinitThread();
                Session session = NotesFactory.createSessionWithFullAccess();
                if (event.data instanceof URIDescriptor[]){ 
                    URIDescriptor[] droppedURL = (URIDescriptor[]) event.data;
                    for (int i = 0; i < droppedURL.length; i++) { 
                        URI uri = ((URIDescriptor) droppedURL[i]).uri;
                        Document d = (Document) session.resolve(uri.toString());
                        // Do things with the document
                    }					
                }
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                NotesThread.stermThread();
            }
        }});

Use session.resolve instead of db.getDocumentByURL to retrieve a document from a plugin, as both session.getAgentContext() and session.getCurrentDatabase() will return null.

Short URL: http://sachachua.com/blog/p/7304

LotusScript: Checking another database for categories that do not contain a document of a particular type

We want to scale up Innovation Discovery and share the insights/workshop methods with more people, so one of my tasks is to remove sensitive information from our workshop output documents, post the scrubbed output documents in our community, and update the relevant sector page in our wiki.

This would be easier if people notified me after engagements, but at least we’ve gotten people into the habit of adding files to the Teamroom. I decided that instead of asking people to remember one more step in our post-engagement process, I would just regularly get into the habit of checking the Teamroom for updated documents. The Teamroom date view is useful, but there are other documents mixed into this, and I don’t think I can get my team members to adopt a consistent naming scheme or document type. However, if I wrote an agent to tell me which client categories didn’t have a final output document entry yet, I could use that to find new entries and follow up on old ones. So I did.

I didn’t have access to create new agents in the Teamroom database. I worked around this by creating this agent in my own database and then connecting to the other database from there.

Sub Initialize
	'This script looks for all the client categories that do not have a final documents entry
	'Display the current document's Categories field
	
	Dim dbID As New NotesDatabase("","dbom1\global18.nsf")
	Dim doc As NotesDocument
	Dim catView As NotesView
	Set catView = dbID.getView("CategoryLookup")
	'Determine list of clients
	Set doc = catView.Getfirstdocument()
	Dim clients List As String
	Dim finished List As String
	Do Until(doc Is Nothing)
		Dim category As String
		category = doc.Getitemvalue("Categories")(0)
		If (InStr(category, "Clients") <> 0) Then
			'This belongs in the client category. Has it been found? Add it to the list
			category = Mid(category, 9)
			clients(category) = category 
			If (doc.GetItemValue("DocType")(0) = "Final output") Then
				finished(category) = category 	
			End If 
		End if
		Set doc = catView.Getnextdocument(doc)
	Loop
	'Remove completed items
	Dim s As String
	s = ""
	ForAll client In clients
		If (Not IsElement(finished(client))) then
			s = s + client + " "
		End if
	End ForAll
	MessageBox(s)
End Sub

I change entries to the “Final output” document type after I’ve processed them. So far, so good!

Short URL: http://sachachua.com/blog/p/7218

Custom fields in Lotus Notes / Domino? You may need to set the SUMMARY field flag

It took me a few hours to figure out that I needed the SUMMARY field flag, so I thought I’d save you the struggle if you ever need to create a view with custom columns.

I was trying to create a view that showed the custom fields I’d added to an RSVP message: RSVPCampaign, RSVPCode, and other details. I had created a Lotus Notes button that sent me an e-mail with the information in hidden fields. I successfully processed the extra fields using a LotusScript agent. I wanted to create a view that showed the results so that I didn’t have to keep clicking on the button and checking my mail. Using a view would make it easier for me to share these tools with other people, because I figured out how to create a button that creates a view.

I couldn’t figure out how to get my custom fields to display, though. They showed up in @DocFields, but @IsAvailable(RSVPCampaign) was always false.

I read about all of the functions in the Formula language. I experimented with @GetField, field names, and other ways to access data. I dug through documentation and websites (most of which assumed people already knew things like this). Frustrated, I opened the properties dialog and started systematically going through the fields on my RSVP messages.

It took me several passes to notice that the regular fields had “Field Flags: SUMMARY” and my custom fields didn’t.

After some quick searching, I realized that I needed to set the summary field flag. So I rewrote my RSVP mailing function to include lines like this:

Dim item As NotesItem
Set item = New NotesItem(doc, "RSVPCode", code) item.IsSummary = True

I tested my new RSVP mailing button, and my view worked!

So if you’re stumped because your custom fields don’t work in view selection formulas or in column formulas, set the summary flag on the field when you set the field, and you should be good to go.

I wonder how I could’ve learned that faster. Reading other people’s source code would help. Forums are useful, too. Part of it involves picking up the jargon so that I know how to phrase my searches. Anyway, I fixed it! =D

Short URL: http://sachachua.com/blog/p/7190

Even more awesome LotusScript mail merge for Lotus Notes + Microsoft Excel

UPDATE: May 20, 2011 – David Turner has shared his excellent improvements. Check them out!

UPDATE: May 28, 2010 – fixed errors caused by default Option Declare. Thanks to Lisa Harnett for the feedback!
UPDATE: Oct 19, 2010 – fixed Quit(). Thanks to Vance for the feedback! Also, clarified tokens.

Based on the feedback on my Lotus Notes mail merge from a Microsoft Excel spreadsheet (2009), I’ve refined my merge script to make it more awesome. How is it more awesome?

  • Prompts you for drafting or sending
  • Saves sent messages
  • Allows you to customize the subject
  • Uses [ ] instead of < and > for built-in tokens ([to], [cc], [subject]) for less HTML confusion in blog posts and replies
  • Displays number of sent messages and errors
  • Closes the Microsoft Excel spreadsheet afterwards

The search-and-replace tokens are defined in the first row of your Microsoft Excel spreadsheet. The script searches for them in the message body, replaces them with the appropriate values from the current row, and either saves the message as the draft or sends the message. There are a few built-in tokens for this script ([to], [cc], [subject]) – these are case-sensitive, so enter them exactly like that. All the other tokens are up to you, so you could use FOO and BAR as search-and-replace tokens if you want.

Tokens are replaced only in the message body. If you want a variable subject line, use a formula to calculate the subject in a column with the [subject] header.

As always, test your mail merges with a small list before using it for your entire list. Create an agent and call it something like “Mail merge”. Edit the agent and set the type to LotusScript. In the (Declarations) section, add

%Include "lsconst.lss"

In the “Initialize” section, put in:

Sub Initialize
	'Mail merge script by Sacha Chua (sacha@sachachua.com)

	Dim ws As NotesUIWorkspace
	Set ws = New NotesUIWorkspace
	Dim sendTypes(1) As String
	Dim sendValue As String
	Dim errorCount As Integer
	errorCount = 0
	sendTypes(0) = "Draft messages without sending"
	sendTypes(1) = "Send messages"
	sendValue = ws.Prompt(PROMPT_OKCANCELLIST, "Sending options", "What would you like to do?", "", sendTypes)
	If (sendValue = "") Then
		Exit Sub
	End If

	Dim fileName As String
	Dim strXLFilename As String
	'Prompt for the filename - should be a Microsoft Excel file with columns, where the first row of each column
	'is a token that will be used when replacing text in the body of the message
	'Special tokens: [to], [cc], [subject] set the appropriate fields
	'Make sure the first column does not have any blank cells
	fileName$ = ws.Prompt(12, "Select file", "3")
	If fileName$ = "" Then
		Exit Sub   'Cancel was pressed
	End If
	strXLFilename = fileName$
	Dim s As New NotesSession
	Dim uidoc As NotesUIDocument
	Dim partno As String
	Dim db As NotesDatabase
	Dim view As NotesView
	Dim doc As NotesDocument
	Dim collection As NotesDocumentCollection
	Dim memo As NotesDocument
	Dim body As NotesRichTextItem
	Dim newBody As NotesRichTextItem
	Dim range As NotesRichTextRange
	Dim count As Integer

	Set db = s.CurrentDatabase
	Set collection = db.UnprocessedDocuments
	Set memo = collection.getFirstDocument()

	Dim varXLFile As variant
	'Get data from the spreadsheet
	Set varXLFile = CreateObject("Excel.Application")
	varXLFile.Visible = False
	Dim varXLWorkbook As variant
	Set varXLWorkbook = Nothing
	varXLFile.Workbooks.Open strXLFilename
	Set varXLWorkbook = varXLFile.ActiveWorkbook
	Dim varXLSheet As variant
	Set varXLSheet = varXLWorkbook.ActiveSheet

	Dim lngRow As Integer
	Dim columnNo As Integer
	Dim token As String
	Dim value As string
	lngRow = 2
	Dim maildoc As NotesDocument
	While (Not (varXLSheet.Cells(lngRow, 1).Value = ""))
		'Fill in the template
		Dim subject As string
		subject = memo.Subject(0)
		Set body = memo.GetFirstItem("Body")

		'Compose message
		
		Set maildoc = New NotesDocument(db)
		Set maildoc= db.CreateDocument()
		maildoc.Form = "Memo"
		maildoc.Subject = subject
		Set newBody = maildoc.CreateRichTextItem("Body")
		Call newBody.appendRTItem(body)
		Set range = newBody.CreateRange			

		'Count the number of fields
		'Look up tokens from the column headings and replace them
		columnNo = 1
		While Not(varXLSheet.Cells(1, columnNo).Value = "")
			token = varXLSheet.Cells(1, columnNo).Value
			value = varXLSheet.Cells(lngRow, columnNo).Value
			count = range.FindAndReplace(token, value, 16)
			If (token = "[to]") Then
				maildoc.SendTo = value
			End If
			If (token = "[cc]") Then
				maildoc.CopyTo = value
			End If
			If (token = "[subject]") Then
				maildoc.Subject = value
			End If
			columnNo = columnNo + 1
		Wend
		On Error GoTo save
		If (sendValue = sendTypes(0)) Then
			Call maildoc.Save(True, False)
		Else
			maildoc.SaveMessageOnSend = True
			maildoc.PostedDate = Now()
			Call maildoc.Send(False)
			Call maildoc.Save(True, True)
		End If
		GoTo nextrow
save:
		MessageBox("Error processing " + maildoc.sendTo)
		errorCount = errorCount + 1
		Resume Next
nextrow:
		lngRow = lngRow + 1
	Wend
	If (sendValue = sendTypes(0)) Then
		MsgBox "Drafted " & (lngRow - errorCount - 2) & " message(s). Errors: " & errorCount
	Else
		MsgBox "Sent " & (lngRow - errorCount - 2) & " message(s). Errors: " & errorCount
	End If
	Call varXLFile.Quit()
End Sub
Short URL: http://sachachua.com/blog/p/7189

Get the highlights as a PDF!

Stories from my Twenties: Highlights from a Decade of Blogging

Free sample!