Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Numbering / September 2005

Tip: Looking for answers? Try searching our database.

VBA numbering

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Phoenix - 21 Sep 2005 15:32 GMT
Hi,

i'm having trouble trying to retrieve the numbering assigned to a
paragraph.

if the number is manually added to the line then i can get the value
with ease through the range variable, but if all numbers are generated
via the word numbering system they do not show through the range
option.

Does anyone know how i can get hold of the value

thanx in advance

James
Greg - 21 Sep 2005 16:35 GMT
Sub Scratchmacro()
   Dim myRng As Range
   Set myRng = Selection.Paragraphs(1).Range
   MsgBox myRng.ListFormat.ListString _
   & " " & myRng
End Sub
Phoenix - 22 Sep 2005 09:01 GMT
I have tried this method and only get an empty string back from the
query. Do you know of any other ways that i could get hold of the
value.

thanx in advance

James
Greg Maxey - 22 Sep 2005 10:52 GMT
Of course I don't know exactly what it is that you are doing.  In this case,
if you put your cursor in a Word paragraph that contains text and run the
macro I provided I don't see how it is possible to return and empty string.
Sorry.

Signature

Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

> I have tried this method and only get an empty string back from the
> query. Do you know of any other ways that i could get hold of the
[quoted text clipped - 3 lines]
>
> James
Phoenix - 22 Sep 2005 12:10 GMT
i have to call this macro from a c# application. so the number is being
inserted into a text file which can then be read by the application.

so from your above comment if i manage to get the macro to select the
line then run your macro i should get the values i require.

Cheers
Greg - 22 Sep 2005 13:31 GMT
Phoenix,

My macro is very simplistic.  It is intended to illustrate how the list
numbered paragraph's text range and list string can be combined and
displayed by a message box.  You will most likely want to adapt my
macro to suit your specific needs.
Phoenix - 22 Sep 2005 16:44 GMT
i have tried your macro would it be possible for you to e-mail your
sample to me. Then i can see where i'm going wrong.

Thanx
Jonathan West - 22 Sep 2005 18:29 GMT
>i have tried your macro would it be possible for you to e-mail your
> sample to me. Then i can see where i'm going wrong.
>
> Thanx

Greg has already posted here all the code that he has written for you. Place
that code in a VBA project, position the cursor in the paragraph whose
numbering you want to check, and run the macro.

It is a demonstration of concept - it displays a message box showing the
ListString of the paragraph that the cursor currently occupies. That is
almost certainly not what you want to do, but the code shows you which part
of the object model you have to use in order to do what you want.

You have already worked out how to get the number if it is manually typed
in. With the same Range object that you used there, get the
ListFormat.ListString property. That will give you the number you want.

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org 

Phoenix - 26 Sep 2005 08:31 GMT
I have tried now  and got the demonstration submitted by greg working.
still through the range i cannot get the number it return a "" empty
quote, any other ideas

Thanx
Phoenix - 27 Sep 2005 10:33 GMT
I have managed to get this working to a degree. the problem still
exists when the item is more situated 2 or more indents. is there
another function that i have to make use of to get this value or is it
a problem with 2003.

thanx

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.