Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default x = textbox1.value (somethings wrong)

I'm at a loss here. What have i done wrong?

put in the amount in a textbox and the image sizes, but if i want t
add something to the size like 2 other variables then something goe
wrong

Hgt = textbox1.value
Image1.Height = Hgt - TT - TV

Should i be coverting the value to a long type?
Thanks for looking
CA

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default x = textbox1.value (somethings wrong)

You need convert Hgt

e.g.
Hgt = Val(textbox1.value)
Image1.Height = Hgt - TT - TV

"CAA " wrote in message
...
I'm at a loss here. What have i done wrong?

put in the amount in a textbox and the image sizes, but if i want to
add something to the size like 2 other variables then something goes
wrong

Hgt = textbox1.value
Image1.Height = Hgt - TT - TV

Should i be coverting the value to a long type?
Thanks for looking
CAA


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default x = textbox1.value (somethings wrong)

It certainly won't hurt.

What is in TT & TV?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"CAA " wrote in message
...
I'm at a loss here. What have i done wrong?

put in the amount in a textbox and the image sizes, but if i want to
add something to the size like 2 other variables then something goes
wrong

Hgt = textbox1.value
Image1.Height = Hgt - TT - TV

Should i be coverting the value to a long type?
Thanks for looking
CAA


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default x = textbox1.value (somethings wrong)

Still not right?

I run the form and enter, say 900 in the text box. When the value of T
& TV = 0 (just text positions if they exist) all is ok. Then when TT i
not 0 all go's to pot.
Says cannot set height, so i look at the value of HGT and it is 0, wh
would it be 0?

using
Hgt = Val(textbox1.value)

I have declared Hgt, TT and TV as Long types.
should i be decalring another type to hold the result of Hgt - TT
TV?

It seems a simple thing, why is it thrashing my head!?

Thanks for looking
CA

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default x = textbox1.value (somethings wrong)

Carlos,

That doesn't surprise me because if the textbox is a number, even though
textbox returns a string it can ad correctly.

You didn't answer my question about what was in TT and TV. If the total of
TT and Tv exceeds the textbox value then you will get an error. You should
trap the error with

Hgt = Val(TextBox1.Value)
If Hgt (TT + TV) Then
Image1.Height = Hgt - (TT + TV)
Else
MsgBox "Invalid height for image"
With TextBox1
.SelStart = 0
.SelLength = Len(.Text)
.SetFocus
End With
End If


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"CAA " wrote in message
...
Still not right?

I run the form and enter, say 900 in the text box. When the value of TT
& TV = 0 (just text positions if they exist) all is ok. Then when TT is
not 0 all go's to pot.
Says cannot set height, so i look at the value of HGT and it is 0, why
would it be 0?

using
Hgt = Val(textbox1.value)

I have declared Hgt, TT and TV as Long types.
should i be decalring another type to hold the result of Hgt - TT -
TV?

It seems a simple thing, why is it thrashing my head!?

Thanks for looking
CAA


---
Message posted from http://www.ExcelForum.com/





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default x = textbox1.value (somethings wrong)

Thanks Bob,
I had done the error checking in an erlier piece of code by setting Hg
to 100 as a minimum as TT + VT could only be 90, however your commen
made me think more about what i'd done and basically i'm a plonker
again..
I had put this before an End If statement, so it was not even take
into account. Oh, the humiliation

Thanks for Alleviating the few brain Cells i have left, they really d
appreciate it & are going to celebrate in a few hours by playing
little game of Russian Vodka roulette in your honour.

CA

--
Message posted from http://www.ExcelForum.com

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default x = textbox1.value (somethings wrong)

CAA,

Glad to help. I'll have a Tequila to share it with you!

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"CAA " wrote in message
...
Thanks Bob,
I had done the error checking in an erlier piece of code by setting Hgt
to 100 as a minimum as TT + VT could only be 90, however your comment
made me think more about what i'd done and basically i'm a plonker,
again..
I had put this before an End If statement, so it was not even taken
into account. Oh, the humiliation

Thanks for Alleviating the few brain Cells i have left, they really do
appreciate it & are going to celebrate in a few hours by playing a
little game of Russian Vodka roulette in your honour.

CAA


---
Message posted from http://www.ExcelForum.com/



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
Somethings Missing . . . . . [email protected] Excel Discussion (Misc queries) 3 April 20th 06 02:33 PM
TextBox1 to Label4 damorrison Excel Discussion (Misc queries) 5 March 12th 06 04:05 PM
Shift key down for 6 secs and somethings happened ? How to undo Cherie Excel Discussion (Misc queries) 2 January 5th 06 05:28 PM
Highlighting Textbox1 Value when form initializes. Todd Huttenstine[_3_] Excel Programming 2 November 26th 03 10:35 PM
UserForm1.Textbox1.SetFocus Question Zane Greer Excel Programming 1 September 14th 03 11:59 AM


All times are GMT +1. The time now is 10:56 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"