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.

Re: Populate a VBA variable from text on the page by Jonathan

Jonathan
Thu Aug 02 17:18:15 CDT 2007


"danhattan" <hatinonya@screwthespammers.com> wrote in message
news:05B46115-6E8F-47E7-9C7F-CFD9850148A0@microsoft.com...
> 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)


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup



Re: Populate a VBA variable from text on the page by hatinonya

hatinonya
Thu Aug 02 17:50:00 CDT 2007

Sweet. And Simple. Mucho Merci!

"Jonathan West" wrote:

>
> "danhattan" <hatinonya@screwthespammers.com> wrote in message
> news:05B46115-6E8F-47E7-9C7F-CFD9850148A0@microsoft.com...
> > 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)
>
>
> --
> Regards
> Jonathan West - Word MVP
> www.intelligentdocuments.co.uk
> Please reply to the newsgroup
>
>
>