Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Can't assign a textbox to object

Running vb6 in xl2000.

I can't assign a textbox to a textbox object. Why not?

Assume that TextBox1 and CommandButton1 are defined on some form, or
worksheet, then this works:

Dim cb As CommandButton
Set cb = CommandButton1

But this fails with a type mismatch:

Dim tb As TextBox
Set tb = TextBox1

I seems that TextBox1 does not refer to the TextBox as a whole, but to the
text that it contains, i.e. TextBox1.Text.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 320
Default Can't assign a textbox to object

try (untested)
Set tb=Me.controls("Textbox1")

Bob Umlas
Excel MVP

"colin.." wrote in message
...
Running vb6 in xl2000.

I can't assign a textbox to a textbox object. Why not?

Assume that TextBox1 and CommandButton1 are defined on some form, or
worksheet, then this works:

Dim cb As CommandButton
Set cb = CommandButton1

But this fails with a type mismatch:

Dim tb As TextBox
Set tb = TextBox1

I seems that TextBox1 does not refer to the TextBox as a whole, but to the
text that it contains, i.e. TextBox1.Text.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Can't assign a textbox to object

Bob,
This still gives a type mismatch.
colin..


"Bob Umlas" wrote:

try (untested)
Set tb=Me.controls("Textbox1")

Bob Umlas
Excel MVP

"colin.." wrote in message
...
Running vb6 in xl2000.

I can't assign a textbox to a textbox object. Why not?

Assume that TextBox1 and CommandButton1 are defined on some form, or
worksheet, then this works:

Dim cb As CommandButton
Set cb = CommandButton1

But this fails with a type mismatch:

Dim tb As TextBox
Set tb = TextBox1

I seems that TextBox1 does not refer to the TextBox as a whole, but to the
text that it contains, i.e. TextBox1.Text.





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Can't assign a textbox to object

There's a textbox in the Drawing toolbar, too.

You'll want to be specific about which type you want to use:

Dim tb As msforms.TextBox

there's only one commandbutton, but this wouldn't hurt:
dim cb as msforms.commandbutton

And might remind you why you did things that way.

colin.. wrote:

Running vb6 in xl2000.

I can't assign a textbox to a textbox object. Why not?

Assume that TextBox1 and CommandButton1 are defined on some form, or
worksheet, then this works:

Dim cb As CommandButton
Set cb = CommandButton1

But this fails with a type mismatch:

Dim tb As TextBox
Set tb = TextBox1

I seems that TextBox1 does not refer to the TextBox as a whole, but to the
text that it contains, i.e. TextBox1.Text.


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Can't assign a textbox to object

Dave,
Many thanks -- that's solved it.
colin..

"Dave Peterson" wrote:

There's a textbox in the Drawing toolbar, too.

You'll want to be specific about which type you want to use:

Dim tb As msforms.TextBox

there's only one commandbutton, but this wouldn't hurt:
dim cb as msforms.commandbutton

And might remind you why you did things that way.

colin.. wrote:

Running vb6 in xl2000.

I can't assign a textbox to a textbox object. Why not?

Assume that TextBox1 and CommandButton1 are defined on some form, or
worksheet, then this works:

Dim cb As CommandButton
Set cb = CommandButton1

But this fails with a type mismatch:

Dim tb As TextBox
Set tb = TextBox1

I seems that TextBox1 does not refer to the TextBox as a whole, but to the
text that it contains, i.e. TextBox1.Text.


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I assign a macro to a graphic object on the worksheet bigjim Excel Discussion (Misc queries) 1 March 24th 08 03:08 AM
How to assign value to a textbox. Arun Kumar Saha Excel Worksheet Functions 0 December 4th 07 02:15 AM
assign keystroke to object or button rufusf Excel Worksheet Functions 0 March 6th 06 09:35 AM
assign the sub to the object event Marek Excel Programming 1 September 13th 04 08:50 PM
Assign a variables value to a TextBox ed Excel Programming 1 October 25th 03 08:41 PM


All times are GMT +1. The time now is 08:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"