Multiple easy questions.

F

filo666

Hello, I would like to know how to:
1) I'm creating a kind of interactive program, what I need to do is to
select each word of the document, then for each, select all the characters of
the word and then do something with each one of the characters and the go to
the next word, until now I have:

Sub dfd()
Dim oword, ochr As Range
Set oword = ActiveDocument.Words
For n = 1 To oword.Count
oword.Item(n).Select
Set ochr = oword.Item(n).Characters
For Each ochr In oword
'bla bla bla bla ba
Next
Next
End Sub

2) I would like to create a userform, when the userform is deactivated you
are able to correct whatever you want for your document without closing the
userform(like the find and replace form, you can change stuff on your
document without closing the form)

3) a usrform with 2 bottons, before and next, when the before button is
pressed it goes to the last word seleted (or changed) and with the next
button it goes to the next word that fill a spesific criteria.

Thanks for your help
 
J

Jay Freedman

I apologize in advance if I'm mistaken, but these look like homework questions.
If they are, please try to work them out yourself first. If you get stuck on a
particular point, ask a specific question about that point. You won't learn the
intended lessons if someone just hands you the solutions.
 
H

Helmut Weber

Hi filo666,

at 1)
Sub Test555xxx()
Dim rWrd As Range
Dim rChr As Range
' incase of Dim rWrd, rChr As Range
' rWrd would be a variant !
For Each rWrd In ActiveDocument.Range.Words
For Each rChr In rWrd
' your code
Next
Next
End Sub


at 2)
You need a modeless userform, like:
UserForm1.Show vbModeless

at 3)
a userform with 2 bottons, before and next, when the before button is
pressed it goes to the last word seleted (or changed)
That is a bit more difficult
You might explore the predefined bookmarks
"\PrevSel1" and "\PrevSel2"
and with the next button it goes to the next
word that fill a spesific criteria.

Depends on the criteria.




--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 
H

Helmut Weber

Hi Jay,

I wasn't aware of that.

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 
F

filo666

As always, you answered my questions, thank you very much, where did you
learn VB, it seems to me that you know everything!!!!
Kind greatings from Israel.

pd, I finished studing 6 years ago, 6 years with now homeworks.
 
H

Helmut Weber

Hi Filo,

self educated, autodidact.

Have a nice day.

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 

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