Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
fledeboer fledeboer is offline
external usenet poster
 
Posts: 1
Default How to add a mergefield to a blank document via visual basic

Hello,

I am trying to write an add-in with visual studio 2008 (visual basic) for
Word2007 to let users build a mailmerg document template. In the second steo
these mergefields should handle values from an active directory. To do this I
would like to have a ribbongroup with some buttons in it. By pressing a
button a mail merge field e.g. {MERGEFIELD firstname} should be inserted at
the current cursor position.

I don't know how to use the Filed.Add method. Maybe someone has an example
for me?
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP on news.microsoft.com Doug Robbins - Word MVP on news.microsoft.com is offline
external usenet poster
 
Posts: 407
Default How to add a mergefield to a blank document via visual basic

Use:

ActiveDocument.Fields.Add Selection.Range, wdFieldEmpty, "Mergefield
FirstName"


--
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, originally posted via msnews.microsoft.com

"fledeboer" wrote in message
...
Hello,

I am trying to write an add-in with visual studio 2008 (visual basic) for
Word2007 to let users build a mailmerg document template. In the second
steo
these mergefields should handle values from an active directory. To do
this I
would like to have a ribbongroup with some buttons in it. By pressing a
button a mail merge field e.g. {MERGEFIELD firstname} should be inserted
at
the current cursor position.

I don't know how to use the Filed.Add method. Maybe someone has an example
for me?



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
Word Visual Basic ksawb Microsoft Word Help 1 November 5th 07 10:33 AM
Visual Basic error 438 Rose Jenkins Microsoft Word Help 1 September 6th 07 06:26 AM
Activating a document that has visual basic text and form fields solacewind1007 Microsoft Word Help 1 March 28th 07 08:49 PM
what is microsoft visual basic vanman New Users 4 August 13th 05 12:22 AM
Visual Basic and VBA Forum Throne Software Mailmerge 0 July 9th 05 04:23 AM


All times are GMT +1. The time now is 08:17 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"