Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Tom Tom is offline
external usenet poster
 
Posts: 61
Default Use DocVariable field to initiative numbering?

Can the DocVariable field be used to somehow initiate Figure numbering?

Let me explain. Suppose I have the phrase XYZ in a document. I want to
integrate a macro such that each place XYZ appears, a Figure number is
inserted instead. In other words, the macro would say, Find XYZ, and
replace with the caption field.

Is this possible? If so, it might enable me to run a macro to fix a
RoboHelp output to include Figure captions.

  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Tom Tom is offline
external usenet poster
 
Posts: 61
Default Use DocVariable field to initiative numbering?

Maybe I want to use an IF Then statement instead. All of this is new to
me and I'm trying to understand it. Something like:

{IF "XYZ" Then {SEQ Figure \ *Arabic}}

Can someone point me to a good tutorial on if then statements?

In my document, XYZ would be a unique phrase that I'd want to replace
with a figure caption.

  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Use DocVariable field to initiative numbering?

Typicaly a Figure number would contain something like the following (it
depends on the type of reference you choose to have);

Figure { SEQ Figure \*Arabic }

In that case you should be able to start the sequence numbering by inserting
the following nested field at the beginning of your document:

{ SEQ Figure \r{ DOCVARIABLE myvariable } \h }

(depending on what you are doing it might be better to put your starting
number in a Document Property and use the following instead:

{ SEQ Figure \r{ DOCPROPERTY myproperty } \h }
)

Let me explain. Suppose I have the phrase XYZ in a document. I want to
integrate a macro such that each place XYZ appears, a Figure number is
inserted instead. In other words, the macro would say, Find XYZ, and
replace with the caption field.


This seems to be something else altogether. If you just want to replace
every occurence of XYZ in a document with the caption field, the simplest
way is probably
a. create the caption text and fields you want (e.g.
Figure { SEQ Figure \*Arabic }
b. Edit|Copy that stuff so it's on the clipboard
c. use Edit|Replace to replace XYZ by ^c (i.e. the clipboard contents).

If you need to do it using a macro, things get a bit harder.

Peter Jamieson

"Tom" wrote in message
ups.com...
Can the DocVariable field be used to somehow initiate Figure numbering?

Let me explain. Suppose I have the phrase XYZ in a document. I want to
integrate a macro such that each place XYZ appears, a Figure number is
inserted instead. In other words, the macro would say, Find XYZ, and
replace with the caption field.

Is this possible? If so, it might enable me to run a macro to fix a
RoboHelp output to include Figure captions.



  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Tom Tom is offline
external usenet poster
 
Posts: 61
Default Use DocVariable field to initiative numbering?

Thanks Peter. The method of copy and replace seems to do the trick. I
didn't know you could do the ^c function to insert a field like that.
Thanks again! This forum is excellent.

This seems to be something else altogether. If you just want to
replace
every occurence of XYZ in a document with the caption field, the
simplest
way is probably
a. create the caption text and fields you want (e.g.
Figure { SEQ Figure \*Arabic }
b. Edit|Copy that stuff so it's on the clipboard
c. use Edit|Replace to replace XYZ by ^c (i.e. the clipboard contents).

  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Tom Tom is offline
external usenet poster
 
Posts: 61
Default Use DocVariable field to initiative numbering?

I would like to better understand the DOCPROPERTY and DOCVARIABLE
fields.

You gave the following examples:

{ SEQ Figure \r{ DOCVARIABLE myvariable } \h }


(depending on what you are doing it might be better to put your
starting
number in a Document Property and use the following instead:

{ SEQ Figure \r{ DOCPROPERTY myproperty } \h }
)

I'm just not sure how to implement this. I assume "myvariable" and
"myproperty" are unique words I define. But where are they stored? How
do I define them? What exactly do they do? I'm still in the dark here.

Also, I realized the figure captions find-and-replace method only
solves part of the problem. In our HTML document, we have phrases like
this: "See Figure 1" and then below the figure we write "Figure 1."
When I did the find and replace method, it did sequentially number the
figures, but how would I implement the "See Figure 1" part? That seems
impossible.



  #6   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Use DocVariable field to initiative numbering?

Hi Tom,

Well, I'd assumed you knew what a docvariable was because you mentioned them
in the subject line of your post. But maybe you'd picked that up from
somewhere else, and maybe it's completely irrelevant.

But roughly speaking,

You can create document properties and set/modify their values using the
File|Properties dialog box. Personally I wouldn't use any type except
"string" unless I had a good reason. Further, you can modify document
properties programmatically, and view their values, even if you don't have
Word (i.e. the properties are stored in structures that do not rely on
Word). Sometimes, that's a bonus, but I suspect it's not that important in
this case.

Document variables are named values stored within Word. You can't set them
up or maintain them using the standard user interface, and you can only get
at them programmatically by using the Word object model. So they are perhaps
better if you don't want users to modify their values.

The DOCVARIABLE and DOCPROPERTY fields simply insert the values of the
specified document variables and document properties.

If you want to experiment with these field types I suggest you stick to
DOCPROPERTY in the first instance as you can play with these without
resorting to VBA.


Also, I realized the figure captions find-and-replace method only
solves part of the problem. In our HTML document, we have phrases like
this: "See Figure 1" and then below the figure we write "Figure 1."
When I did the find and replace method, it did sequentially number the
figures, but how would I implement the "See Figure 1" part? That seems
impossible.


Yes. However, how to maintain these references depends on what you're
doing - you mention "your HTML document". Are you starting with that and
trying to create a Word document from it, or what?

Peter Jamieson

"Tom" wrote in message
ups.com...
I would like to better understand the DOCPROPERTY and DOCVARIABLE
fields.

You gave the following examples:

{ SEQ Figure \r{ DOCVARIABLE myvariable } \h }


(depending on what you are doing it might be better to put your
starting
number in a Document Property and use the following instead:

{ SEQ Figure \r{ DOCPROPERTY myproperty } \h }
)

I'm just not sure how to implement this. I assume "myvariable" and
"myproperty" are unique words I define. But where are they stored? How
do I define them? What exactly do they do? I'm still in the dark here.

Also, I realized the figure captions find-and-replace method only
solves part of the problem. In our HTML document, we have phrases like
this: "See Figure 1" and then below the figure we write "Figure 1."
When I did the find and replace method, it did sequentially number the
figures, but how would I implement the "See Figure 1" part? That seems
impossible.



  #7   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Tom Tom is offline
external usenet poster
 
Posts: 61
Default Use DocVariable field to initiative numbering?

Peter,

Thanks for the explanations about the differences between DocVariables
and DocProperties. That does make it a little clearer. You asked,

However, how to maintain these references depends on what you're
doing - you mention "your HTML document". Are you starting with that and
trying to create a Word document from it, or what?


To view an HTML document similar to the ones I create, open up Internet
Explorer 6.0 and go to Help Contents and Index. What loads is an Web
Help application of some kind. RoboHelp essentially creates the same
online help tool.

RoboHelp also exports all of these topics to Microsoft Word. Where
RoboHelp falls short is in converting links to cross references. It
just doesn't seem to do it, and I'm not sure of any workaround. That's
why I was thinking that maybe if I stored some kind of variable in the
HTML, I could convert it into a unique cross reference in Word. But
that doesn't really seem probable, right?

  #8   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Use DocVariable field to initiative numbering?

Tom,

What I'd /probably do in this scenario is try to expand on Greg's macro and
look separately for references (e.g. "See Figure nnn") and the figure
identifiers themselves, then mark them in some way that would enable me to
match them up. Greg may have some further ideas but I'll have to think about
how I'd approach this and time marches on on this side of the pond...

Apart from that, I suppose I might want to take another look at RoboHelp
just to be sure that I hadn't missed some referencing feature that would
help me maintain references when I output to Word. But since I don't have
that software, I couldn't really say what I'd be looking for...

Peter Jamieson
"Tom" wrote in message
ups.com...
Peter,

Thanks for the explanations about the differences between DocVariables
and DocProperties. That does make it a little clearer. You asked,

However, how to maintain these references depends on what you're
doing - you mention "your HTML document". Are you starting with that and
trying to create a Word document from it, or what?


To view an HTML document similar to the ones I create, open up Internet
Explorer 6.0 and go to Help Contents and Index. What loads is an Web
Help application of some kind. RoboHelp essentially creates the same
online help tool.

RoboHelp also exports all of these topics to Microsoft Word. Where
RoboHelp falls short is in converting links to cross references. It
just doesn't seem to do it, and I'm not sure of any workaround. That's
why I was thinking that maybe if I stored some kind of variable in the
HTML, I could convert it into a unique cross reference in Word. But
that doesn't really seem probable, right?



  #9   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Tom Tom is offline
external usenet poster
 
Posts: 61
Default Use DocVariable field to initiative numbering?

Peter,

Thanks for the explanations about the differences between DocVariables
and DocProperties. That does make it a little clearer. You asked,

However, how to maintain these references depends on what you're
doing - you mention "your HTML document". Are you starting with that and
trying to create a Word document from it, or what?


To view an HTML document similar to the ones I create, open up Internet
Explorer 6.0 and go to Help Contents and Index. What loads is an Web
Help application of some kind. RoboHelp essentially creates the same
online help tool.

RoboHelp also exports all of these topics to Microsoft Word. Where
RoboHelp falls short is in converting links to cross references. It
just doesn't seem to do it, and I'm not sure of any workaround. That's
why I was thinking that maybe if I stored some kind of variable in the
HTML, I could convert it into a unique cross reference in Word. But
that doesn't really seem probable, right?

  #10   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Greg Maxey Greg Maxey is offline
external usenet poster
 
Posts: 171
Default Use DocVariable field to initiative numbering?

Tom,

I don't see how what a DocVariable has to do with numbering figures.
You want to find "XYZ" and replace with a numbered figure caption
number correct? Try:

Sub ScratchMacro()
Dim myRange As Range
Set myRange = ActiveDocument.Range
With myRange.Find
.Text = "XYZ"
.MatchWholeWord = True
While .Execute
myRange.Delete
myRange.InsertCaption Label:="Figure"
Wend
End With
End Sub


Tom wrote:
Can the DocVariable field be used to somehow initiate Figure numbering?

Let me explain. Suppose I have the phrase XYZ in a document. I want to
integrate a macro such that each place XYZ appears, a Figure number is
inserted instead. In other words, the macro would say, Find XYZ, and
replace with the caption field.

Is this possible? If so, it might enable me to run a macro to fix a
RoboHelp output to include Figure captions.




  #11   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Tom Tom is offline
external usenet poster
 
Posts: 61
Default Use DocVariable field to initiative numbering?

Greg,

Sub ScratchMacro()
Dim myRange As Range
Set myRange = ActiveDocument.Range
With myRange.Find
.Text = "XYZ"
.MatchWholeWord = True
While .Execute
myRange.Delete
myRange.InsertCaption Label:="Figure"
Wend
End With
End Sub


The macro code you wrote works much more quickly and powerfully, even
formatting the XYZ text in caption styles. Thanks!

Here's a little more background with what I'm trying to accomplish, and
why I was wondering about DocVariables. I'm a technical writer trying
to single source with Robohelp. Robohelp is an HTML-based application
that stores everything in discrete topics. It also outputs to Word.
When it outputs to Word, it strings together all the topics in one long
Word document.

The output to Word is problematic for two main reasons:

Captions and references to those captions -- Using the code and
techniques you and Peter explained, I can easily add captions to every
figure (by replacing XYZ with the captions). However, in the body of
the text, we often write "See Figure 1 below" or "See Figure 5 below."
How would I retain the "See Figure 5" part?

A similarly related problem is cross references. Let's say I want to
refer a reader to a topic on another page. In HTML, one simply says
"See Creating Documents" and makes it a link to the topic. However, in
the print output, "See Creating Documents" doesn't include any page
references. The topic could be on page 5 or 50. How could I set it up
so that the print output said "See Creating Documents on page 6" (where
page 6 is where the heading text appears that contains this topic)?

I have been told that it is possible to do this (cross references)
through a DocVariable. This is why I keep asking about it. If you have
a solution for cross references that works, it would make quite a few
technical writers happy. Any ideas?

  #12   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Tom Tom is offline
external usenet poster
 
Posts: 61
Default Use DocVariable field to initiative numbering?

Actually, I see that someone does have a solution for cross-references,
but it isn't ideal. Can any of you improve upon the method here?

http://www.grainge.org/pages/authori...m#broken_links

  #13   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Greg Maxey Greg Maxey is offline
external usenet poster
 
Posts: 171
Default Use DocVariable field to initiative numbering?

Tom,

Sorry I can't help here. I don't even know what HTML is and without a
sample document that I could run this code on, I can't make sense out
of it.


Tom wrote:
Actually, I see that someone does have a solution for cross-references,
but it isn't ideal. Can any of you improve upon the method here?

http://www.grainge.org/pages/authori...m#broken_links


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
Setting Date property in a form field mdavison Microsoft Word Help 13 October 6th 06 02:43 PM
Insert numbering field in merged Word document (invoice nos)? CathySWhit Mailmerge 2 May 24th 06 10:17 PM
Caption numbering in chapters Rachel H Microsoft Word Help 8 October 19th 05 10:21 AM
Cannot printing DocVariable Field lubo Microsoft Word Help 1 April 9th 05 07:00 AM
Numbering - skip a level BruceM Microsoft Word Help 4 February 10th 05 07:56 PM


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