Programmatically determining cursor location and current page numb

T

Toby Erkson

I'm pretty good with Excel VBA but I don't know Word VBA so I resort to using
the Macro Recorder and pick out what I need. However, there are some things
the recorder can't help with...

I have an Excel workbook that opens a Word document and adds section headers
and charts to it. A couple of Word VBA questions:

1) How do I determine what page I'm currently on (the pages number
automatically in the document)? I may need to know if the cursor is on the
first page or not.

2) How do I determine where the cursor is on the page? Vertical position
is what I'm after. I want to know this so if the cursor is past a certain
point on the page then my Excel code will add a Page Break. I got the Page
Break, just can't figure out where the cursor currently is.

Thanks!
 
T

Toby Erkson

Nevermind, I found the necessary info here:
http://word.mvps.org/FAQs/MacrosVBA/index.htm

I *did* do a seach here on the "Discussion Groups Home" on the Microsoft web
site and the search results said that nothing was found. So I submitted my
question and suddenly all these results show up from -- I guess? -- my
original search. Very weird.
 

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