[mso] Re: DIAN...is there a "trim" function in Word field codes?... (was Office 97 Word Merge)

  • From: "Greg Chapman" <greg@xxxxxxxxxxxxx>
  • To: <mso@xxxxxxxxxxxxx>
  • Date: Thu, 5 Dec 2002 17:40:37 -0600

Trim rids a string from leading and trailing spaces. In Word, there is a
Left function (actually, it's a VBA intrinsic function).

I don't know how you might enter the Left function in the field's
definition but the macro below should return the first letter of every
MailMerge field in the document:

Sub GetFirstLetterFromMergeField()

Dim objFields As FormFields
Dim objField As FormField

Set objFields = ActiveDocument.FormFields
For Each objField In objFields
    If objField.Type = wdFieldMergeField Then
        strField = "First letter of " & objField.Result & _
                    " is " & Left(objField.Result)
        MsgBox strField
Next objField
        
End Sub

Would that help? What were you hoping to do with the data after that
point?

Greg Chapman
http://www.mousetrax.com 
"Counting in binary is as easy as 01, 10, 11!
With thinking this clear, is coding really a good idea?"


> -----Original Message-----
> From: mso-bounce@xxxxxxxxxxxxx 
> [mailto:mso-bounce@xxxxxxxxxxxxx] On Behalf Of Linda F. Johnson
> Sent: Thursday, December 05, 2002 5:02 PM
> To: mso@xxxxxxxxxxxxx
> Subject: [mso] DIAN...is there a "trim" function in Word 
> field codes?... (was Office 97 Word Merge)
> 
> 
> 
> Ya got me, Glenda....if anyone would know, it would be 
> Dian....so I added her name to the subject
> 
> And, sorry, digest users, but I'm going to leave the history 
> of this thread in tact so Dian can see it all
> 
> Linda
> Publisher ~ ABC ~ All 'Bout Computers
> Owner ~ Linda's Computer Stop http://personal-computer-tutor.com
> FREE MS Office eBook Tutorial 
> http://personal-computer-tutor.com/library.htm
>  
> 
> 
> -----Original Message-----
> From: mso-bounce@xxxxxxxxxxxxx 
> [mailto:mso-bounce@xxxxxxxxxxxxx] On Behalf Of Glenda Wells
> Sent: Thursday, December 05, 2002 2:15 PM
> To: 'mso@xxxxxxxxxxxxx'
> Subject: [mso] Re: Office 97 Word Merge
> 
> 
> 
> duh me. of course I'd ask a question without giving enough 
> information. sorry.
> 
> the data comes from a third party system over which I have 
> absolutely no control. the system is Access based but I don't 
> have access to it.  I can only control the merge field.  What 
> I think I need is some way of putting the trim function or 
> code in the mergefield itself.
> 
> is that even possible?
> 
> g
> 
> 
> 
> 
> 
> -----Original Message-----
> From: Linda F. Johnson [mailto:linda@xxxxxxxxxxxxxxxxxxxxxxxxxxx] 
> Sent: Thursday, December 05, 2002 12:39 PM
> To: mso@xxxxxxxxxxxxx
> Subject: [mso] Re: Office 97 Word Merge
> 
> 
> 
> Where is the data?  In Word?  Access?  Excel?
> 
> If it's in Excel, you can just add a column and use the LEFT 
> function to get the first letter of the word ... 
> =LEFT(A1)
> 
> Then you can use that column as the field in your mail merge
> 
> If it's in Word, tell me how you trimmed it in the first 
> place and I can probably tell you how to get it into the 
> merge....but I'm sorry, I don't know how to "trim" in Word.  
> (If it were me, I would highlight all the data in the Word 
> table and copy it and paste it into Excel, then do what I said
> above)
> 
> If it's in Access, I have no clue how to do it...sorry.
> 
> Personally, I find Excel is the best place to store a flat 
> database for Word Mail Merges.  Word tables just don't give 
> me enuf functionality and Access is overkill for a flat database, IMO.
> 
> 
> Linda
> Publisher ~ ABC ~ All 'Bout Computers
> Owner ~ Linda's Computer Stop http://personal-computer-tutor.com
> FREE MS Office eBook Tutorial 
> http://personal-computer-tutor.com/library.htm
>  
> 
> 
> 
> -----Original Message-----
> From: mso-bounce@xxxxxxxxxxxxx 
> [mailto:mso-bounce@xxxxxxxxxxxxx] On Behalf Of > Glenda Wells
> 
> Sent: Thursday, December 05, 2002 11:46 AM
> To: 'mso@xxxxxxxxxxxxx'
> Subject: [mso] Office 97 Word Merge
> 
> 
> Please forgive if this is a duplicate. I wasn't sure I sent 
> this earlier.  I can't find my sent copy or a reply.  My 
> system crashed twice so I might have meant to and 
> didn't...it's one of those days!
>  
> The data is a full single word such as Training or Filming. 
> In a merge for labels, I only need the first letter of the 
> word.  I know how to trim to get the letter but how do I 
> include that in a merge field?
>  
> /g
> 
> 
> 
> *************************************************************
> You are receiving this mail because you subscribed to 
> mso@xxxxxxxxxxxxx or MicrosoftOffice@xxxxxxxxxxxxxxxx
> 
> To send mail to the group, simply address it to mso@xxxxxxxxxxxxx
> 
> To Unsubscribe from this group, send an email to 
> mso-request@xxxxxxxxxxxxx?Subject=unsubscribe
> 
> Or, visit the group's homepage and use the dropdown menu.  
> This will also allow you to change your email settings to 
> digest or vacation (no mail). //www.freelists.org/webpage/mso
> 
> To be able to use the files section for sharing files with 
> the group, send a request to mso-moderators@xxxxxxxxxxxxx and 
> you will be sent an invitation with instructions.  Once you 
> are a member of the files group, you can go here to 
> upload/download files: http://www.smartgroups.com/vault/msofiles
> *************************************************************
> 
> 

*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx?Subject=unsubscribe

Or, visit the group's homepage and use the dropdown menu.  This will also allow 
you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions.  Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************

Other related posts: