Windows versions diff

G

Garry Jones

On UserForm_Initialize() I read in a value to a text box.

This following code then highlights the text in that text box.

With TextBox1
..SelStart = 0
..SelLength = Len(.Text)
..SetFocus
End With

But this only works on Windows 98, but not on Windows 2000.

Is there any other code that is universal and will give me the same
effect in both operating systems?

Garry Jones
 
A

Anders S

What happens (does not happen) on your Win 2000 system?

This works for me with Windows 2000, Excel XP:

'****
Private Sub UserForm_Initialize()
TextBox1.Text = "Blaha blaha"
With TextBox1
..SelStart = 0
..SelLength = Len(.Text)
..SetFocus
End With
End Sub
'****

Regards
Anders Silvén
 
G

Garry Jones

Anders said:
What happens (does not happen) on your Win 2000 system?

The text was not highlighted with my code. On a friends windows 2000,
Excel 2000.

I took the exact same file home on a diskette to windows 98, excel 97
and the text was highlighted.

Can it matter that I am reading in the text as control source?

Maybe my friend is missing a setting for colour of highlighted text?

Garry Jones
 
H

Harald Staff

Hi Garry

Try pressing a character key. If it works right then the old text will be replaced by your
entry, colored or not. I've had no problems with code like that on any Windows platform
either.
 

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