a Tab between Caption-number and the Caption-text

K

karitaat

Hi,

I am new here.

I would like to get a tab-character between the CaptionNr and the
Caption Text,
say: Figure 1<tab>This is the caption of my first figure.

Ideally user will press a button (in a Figure, Table and the like) and
will get a (? the Caption) dialog with the proper lead-in text
selected.
User will type the caption text (eg: This is the caption of my first
figure);
press [OK]

and, presto:
the doc will contain the field: Figure {SEQ Figure \* ARABIC }<tab>This
is the caption etc.

Tried to use Dialogs(wdDialogsInsertCaption) and tweak the .Title
Tried to use the .InsertCaption method and fiddle with Title:=

nothing helped: I just can't get the user-typed string.

Any ideas?

regards,
Aquarius
 
C

Cindy M.

I would like to get a tab-character between the CaptionNr and the
Caption Text,
say: Figure 1<tab>This is the caption of my first figure.

Ideally user will press a button (in a Figure, Table and the like) and
will get a (? the Caption) dialog with the proper lead-in text
selected.
User will type the caption text (eg: This is the caption of my first
figure);
press [OK]

and, presto:
the doc will contain the field: Figure {SEQ Figure \* ARABIC }<tab>This
is the caption etc.

Tried to use Dialogs(wdDialogsInsertCaption) and tweak the .Title
Tried to use the .InsertCaption method and fiddle with Title:=

nothing helped: I just can't get the user-typed string.
I think Word makes sure there's nothing but a space between the caption
information and whatever the user types. So you need to let Word insert
the caption, then manipulate it. Something along these lines

Sub InsertCaption()
Dialogs(wdDialogInsertCaption).Show
Dim rng As Word.Range
Set rng = Selection.Range.Paragraphs(1).Range.Fields(1).Result
rng.Collapse wdCollapseEnd
rng.Delete wdCharacter, 1
rng.Text = vbTab
End Sub


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
K

karitaat

Cindy M. schreef:
I would like to get a tab-character between the CaptionNr and the
Caption Text,
say: Figure 1<tab>This is the caption of my first figure.

Ideally user will press a button (in a Figure, Table and the like) and
will get a (? the Caption) dialog with the proper lead-in text
selected.
User will type the caption text (eg: This is the caption of my first
figure);
press [OK]

and, presto:
the doc will contain the field: Figure {SEQ Figure \* ARABIC }<tab>This
is the caption etc.

Tried to use Dialogs(wdDialogsInsertCaption) and tweak the .Title
Tried to use the .InsertCaption method and fiddle with Title:=

nothing helped: I just can't get the user-typed string.
I think Word makes sure there's nothing but a space between the caption
information and whatever the user types. So you need to let Word insert
the caption, then manipulate it. Something along these lines

Sub InsertCaption()
Dialogs(wdDialogInsertCaption).Show
Dim rng As Word.Range
Set rng = Selection.Range.Paragraphs(1).Range.Fields(1).Result
rng.Collapse wdCollapseEnd
rng.Delete wdCharacter, 1
rng.Text = vbTab
End Sub


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)


This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)

Cindy,

Thank you for looking into the problem.

Yes: I think you are right that Word does not want to see anything else
than a space between the Caption and the contents.
I think this is a design flaw, because it makes it harder to make a
proper Caption-Style (eg: hanging indent) and TOC-Style.

But what I think is a far worse design-flaw is that the name of the
Caption is the same as the Caption itself.
We have Word-UK, but the application I am working on (a report) needs
to be in other European languages as well.
In Dutch a 'Table' is a 'Tabel', in German a 'Figure' is a 'Figur'.
Now: I cannot rename the Captions of wdCaptionTable or wdCaptionFigure.
I only can Add the foreign Caption.

But if I run Selection.InsertCaption: both 'Table' and 'Tabel' (or:
'Figure' and 'Figur') are presented. This is asking for trouble!

So I will make a userform that mimics the behaviour of
wdDialogsInsertCaption.
This way I can control what Word is doing.

Regards,
Aquarius
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top