Populate a VBA variable from text on the page

D

danhattan

I'm currently copying a text with numbered verses in each chapter from a web
site and pasting to Word. There are three translations of each verse. I
created a Do loop to remove 2 of the translations from each verse. The loop
length is controlled by an integer variable I populate via an InputBox
function.

It occurred to me that it would be easy enough to capture that number after
the paste (it's the number of the last verse), and then put it into the code
itself and dispense with the input box. Sort of. I can get the cursor to
locate that number and select it, but I'm stumped as to how to get that
number into the VBA code to populate the variable.

If anyone knows how to do this, much appreciated if you could share. Thanks.
 
J

Jonathan West

danhattan said:
I'm currently copying a text with numbered verses in each chapter from a
web
site and pasting to Word. There are three translations of each verse. I
created a Do loop to remove 2 of the translations from each verse. The
loop
length is controlled by an integer variable I populate via an InputBox
function.

It occurred to me that it would be easy enough to capture that number
after
the paste (it's the number of the last verse), and then put it into the
code
itself and dispense with the input box. Sort of. I can get the cursor to
locate that number and select it, but I'm stumped as to how to get that
number into the VBA code to populate the variable.

If anyone knows how to do this, much appreciated if you could share.
Thanks.

numVerse = Val(Selection.Text)
 

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