Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
aeacsharp
 
Posts: n/a
Default Doug's Attachment macro-handling empty cells

Doug Robbins' tutorial and macro for merging with email attachments is
terrific -- thanks!

But in my case, I would like the macro to handle cases in which rows in
the "directory" word file are empty, moving on to the next row/record
email address. This case comes about because my directory has a fixed
number of columns, but the number of attachments in any row may vary,
from a minimum of 1, up to 10. My data source is an access table,
itself the result of a make-table query activated by a command button
on a form.

However, I do find the macro to work flawlessly when all the attachment
columns contain data with a valid path, with no empty cells.

Has anyone a suggestion for accomplishing what I want to do?

thanks!

  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
aeacsharp
 
Posts: n/a
Default Doug's Attachment macro-handling empty cells

I;m sorry, i mis-stated something he
"But in my case, I would like the macro to handle cases in which
**rows** in the "directory" word file are empty, moving on to the next
row/record "

for "rows" substitute the word "cells". I need help in handling empty
cells in the "directory" word file, so that the macro VB does not
"break" when an attachment path resolves to "".

my apologies!

  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
 
Posts: n/a
Default Doug's Attachment macro-handling empty cells

The following modification to the code will check to see if there is a colon
in the cell, as there would be if it contains the path and filename of an
attachment, and only add the attachment if there is:

For i = 2 To Maillist.Tables(1).Columns.Count
Set Datarange = Maillist.Tables(1).Cell(Counter, i).Range
Datarange.End = Datarange.End - 1
If InStr(Datarange, ":") 0 Then
.Attachments.Add Trim(Datarange.Text), olByValue, 1
End If
Next i


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"aeacsharp" wrote in message
oups.com...
I;m sorry, i mis-stated something he
"But in my case, I would like the macro to handle cases in which
**rows** in the "directory" word file are empty, moving on to the next
row/record "

for "rows" substitute the word "cells". I need help in handling empty
cells in the "directory" word file, so that the macro VB does not
"break" when an attachment path resolves to "".

my apologies!



  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
aeacsharp
 
Posts: n/a
Default Doug's Attachment macro-handling empty cells

Outstanding, thanks so much, Doug. Yes, it does help. Works great,
saved us all some time up here.

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
cell's background color not printed correctly [email protected] Tables 2 December 19th 05 01:44 PM
Macro doesn't work Anna Microsoft Word Help 9 October 17th 05 10:25 PM
Select specific cells in table via macro Bill Sturdevant Microsoft Word Help 1 July 27th 05 03:01 PM
Empty cells in data source Shan Mailmerge 3 July 14th 05 10:04 PM
When making labels, how do you delete empty cells? Melissa Microsoft Word Help 1 December 1st 04 06:26 PM


All times are GMT +1. The time now is 11:40 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"