If, Else and Still (can't get it to work)

D

Dave Neve

Hi

Someone called Jason Eascott kindly came to my aid but the posting seems to
have come to an abrupt end.

Could anyone help me out with an answer to my umpteenth quandrum??

Last Posting as follows: (Posting started 17 08 2004 3h.14 French Local
Time)

____________________________________________________________________________
_________

Hi

I thought I understood your code and could finish it off with

Sub RisingLong()

Dim wordrange As Range, lrange As Range, i As Long, j As Long
Set wordrange = Selection.Range

j = 2

For i = 1 To wordrange.Characters.Count
Set lrange = wordrange.Characters(i)

If Selection.Words.Count <= 4 Then
lrange.Font.Size = 8
lrange.Font.Size = lrange.Font.Size + j
j = j + 2
lrange.Font.Spacing = 5
wordrange.Font.Color = wdColorTan

Else
lrange.Font.Size = 8
lrange.Font.Size = lrange.Font.Size + j
j = j + 1
lrange.Font.Spacing = 5
wordrange.Font.Color = wdColorTan


End If
Next i


----------------------------------------------------------

I assumed that 'else' must cover 5 or more characters.

Here's the crunch. The code runs but it doesn't seem to matter if I select a
word with 3 or 5 characters.

Each word starts off with a character of size font 8 and each subsequent
character goes up by 2 sizes !!!!!!

I have other questions as well but I've put them on hold.

Thanks in advance again
 
D

DA

Hi Dave

Couple of points (see below):

Dennis.
-----Original Message-----
Hi

Someone called Jason Eascott kindly came to my aid but the posting seems to
have come to an abrupt end.

Could anyone help me out with an answer to my umpteenth quandrum??

Last Posting as follows: (Posting started 17 08 2004 3h.14 French Local
Time)

_________________________________________________________ ___________________
_________

Hi

I thought I understood your code and could finish it off with

Sub RisingLong()

Dim wordrange As Range, lrange As Range, i As Long, j As Long
Set wordrange = Selection.Range

j = 2

For i = 1 To wordrange.Characters.Count
Set lrange = wordrange.Characters(i)

If Selection.Words.Count <= 4 Then

You're getting the number of words here. In your post it
almost sounds like you want to count the number of
characters in each word, is this the case?
lrange.Font.Size = 8
lrange.Font.Size = lrange.Font.Size + j
j = j + 2
Font size keeps incrementing here, because j is never
reset. For every character in your selection you're
increasing the size by 2.
 
D

Dave Neve

Thanks DA.

I've understood the mistake, the code and managed to get it into the rest of
my macros.

I'll leave the other questions till tomorrow.

Regards
 

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