![]() |
|
![]() |
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
![]() I want to write a macro to count the number of lines between the start of a Word document to where the cursor lies? Is it possible? If so, can you give me some ideas about how this code should be written? |
#2
|
||||
|
||||
![]()
Lines or Paragraphs?
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#3
|
|||
|
|||
![]()
@Andrew Lockton: Lines
|
#4
|
||||
|
||||
![]()
Lines is not the answer I wanted to hear. The concept of lines is particularly problematic as Word has no fixed way of handling it.
For instance, how many lines in a table containing multiple columns? How many lines in a graphic? Do we count empty paragraphs, hard page breaks, section breaks etc.? One feature you might want to consider is turning on Layout > Line Numbers. This will show you that tables are excluded from the numbering. On any given page this should return the line number on the page - unfortunately it returns odd results when tables appear before it. It seems to include some but not all cells. Selection.Range.Information(wdFirstCharacterLineNu mber) As far as I can tell, you would then need to iterate through all preceding pages to work out how many lines on each page and add them all together.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
![]() |
Tags |
lines of text, macro |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
enso | Word | 2 | 05-20-2019 02:58 AM |
![]() |
Olopocram | Word VBA | 15 | 03-07-2018 05:39 PM |
![]() |
d4okeefe | Word VBA | 5 | 11-11-2013 11:02 AM |
![]() |
cattail722 | Word | 5 | 08-26-2013 10:51 AM |
![]() |
NepalKat | Word | 3 | 07-13-2011 06:09 AM |