#1   Report Post  
Posted to microsoft.public.word.docmanagement
BrendaLL
 
Posts: n/a
Default using INCLUDETEXT?

Hello. I'm very new at Word programming. I am a .NET programmer trying to
figure some stuff out in Word. Here is basically what I want to do:

I have a bookmark in a doc and I want to do something like this:

If [bookmark1] = "hello" Then
INCLUDETEXT = "It was found"
Else
INCLUDETEXT = "Not found"
End If

I know that is NOT how it is coded, but I need help getting started on this.

Thanks!
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Charles Kenyon
 
Posts: n/a
Default using INCLUDETEXT?

Look into IF fields.
{ IF bookmark1="hello" "It was found" "Not found" }
The IncludeText field pulls text from another file.

Note, you cannot just type the braces {}. You can use Ctrl-F9 to insert them
or use Insert Field...
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.


"BrendaLL" wrote in message
...
Hello. I'm very new at Word programming. I am a .NET programmer trying
to
figure some stuff out in Word. Here is basically what I want to do:

I have a bookmark in a doc and I want to do something like this:

If [bookmark1] = "hello" Then
INCLUDETEXT = "It was found"
Else
INCLUDETEXT = "Not found"
End If

I know that is NOT how it is coded, but I need help getting started on
this.

Thanks!



  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor
 
Posts: n/a
Default using INCLUDETEXT?

You can do this with an IF field in the document.

{IF {REF Bookmark1 \*lower} = "hello" "It was found" "Not found"}

The \*lower switch is optional but caters for such entries as "Hello" and
"HELLO" as well as "hello"
In a REF field the REF bit is also optional, but I like to include it for
the sake of clarity.
thus
{IF {Bookmark1} = "hello" "It was found" "Not found"}
would probably suffice.

Note the {} indicate fields and are inserted with CTRL+F9.

If you want to use large insertions then you can use INCLUDETEXT fields or
AUTOTEXT fields eg

{IF {REF Bookmark1 \*lower} = "hello" "{INCLUDETEXT
"C:\\path\\filename.doc"}" "{AUTOTEXT "autotextname"}"}

You may find http://www.gmayor.com/formatting_word_fields.htm useful.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


BrendaLL wrote:
Hello. I'm very new at Word programming. I am a .NET programmer
trying to figure some stuff out in Word. Here is basically what I
want to do:

I have a bookmark in a doc and I want to do something like this:

If [bookmark1] = "hello" Then
INCLUDETEXT = "It was found"
Else
INCLUDETEXT = "Not found"
End If

I know that is NOT how it is coded, but I need help getting started
on this.

Thanks!



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
Relative Path in INCLUDETEXT Donna Microsoft Word Help 1 June 12th 05 02:44 AM
INCLUDETEXT problem Michael Microsoft Word Help 1 April 25th 05 07:50 PM
Possible BUG: Multiple HTTPrequests send from one includetext statement Oliver Mailmerge 2 April 18th 05 09:46 AM
IncludeText gives Error! Not a valid filename on 'refresh' Lynn Allan Formatting Long Documents 2 March 9th 05 04:10 AM
IncludeText gives Error! Not a valid filename on 'refresh' Lynn Allan Microsoft Word Help 5 March 9th 05 04:09 AM


All times are GMT +1. The time now is 11:28 AM.

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"