Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Formatting a TextBox on a UserForm

Hi all

I am really struggling to format a TextBox on a UserForm. I'm using
the following code on the Textbox change event, but keep getting - Run-
time error '438': Object does not support this property or method:

TextBox18.Value = Format(UserFormNewItems.TextBox18.Value,
"£#,##0.00")

I'm not experienced with 'Format' as every time i've attempted to use
it i've had similar problems. I've searched the group for a
resolution, but to no avail, i've also tried double quoting the ""£"",
but that diodn't work either

Can anyone please help

Thanks

Jim

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Formatting a TextBox on a UserForm

Maybe it's not Format that's the problem.

This worked for me.

Option Explicit
Private Sub TextBox18_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Me.TextBox18.Value = Format(Me.TextBox18.Value, "£#,##0.00")
End Sub

I formatted the textbox in the _exit event of the userform.

Jimbob wrote:

Hi all

I am really struggling to format a TextBox on a UserForm. I'm using
the following code on the Textbox change event, but keep getting - Run-
time error '438': Object does not support this property or method:

TextBox18.Value = Format(UserFormNewItems.TextBox18.Value,
"£#,##0.00")

I'm not experienced with 'Format' as every time i've attempted to use
it i've had similar problems. I've searched the group for a
resolution, but to no avail, i've also tried double quoting the ""£"",
but that diodn't work either

Can anyone please help

Thanks

Jim


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Formatting a TextBox on a UserForm

Jim,

Try:

TextBox18.Text = Format(UserFormNewItems.TextBox18.Value, "£#,##0.00")


--
Hope that helps.

Vergel Adriano


"Jimbob" wrote:

Hi all

I am really struggling to format a TextBox on a UserForm. I'm using
the following code on the Textbox change event, but keep getting - Run-
time error '438': Object does not support this property or method:

TextBox18.Value = Format(UserFormNewItems.TextBox18.Value,
"£#,##0.00")

I'm not experienced with 'Format' as every time i've attempted to use
it i've had similar problems. I've searched the group for a
resolution, but to no avail, i've also tried double quoting the ""£"",
but that diodn't work either

Can anyone please help

Thanks

Jim


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Formatting a TextBox on a UserForm

On Apr 23, 2:58 pm, Dave Peterson wrote:
Maybe it's not Format that's the problem.

This worked for me.

Option Explicit
Private Sub TextBox18_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Me.TextBox18.Value = Format(Me.TextBox18.Value, "£#,##0.00")
End Sub

I formatted the textbox in the _exit event of the userform.





Jimbob wrote:

Hi all


I am really struggling to format a TextBox on a UserForm. I'm using
the following code on the Textbox change event, but keep getting - Run-
time error '438': Object does not support this property or method:


TextBox18.Value = Format(UserFormNewItems.TextBox18.Value,
"£#,##0.00")


I'm not experienced with 'Format' as every time i've attempted to use
it i've had similar problems. I've searched the group for a
resolution, but to no avail, i've also tried double quoting the ""£"",
but that diodn't work either


Can anyone please help


Thanks


Jim


--

Dave Peterson- Hide quoted text -

- Show quoted text -


I've tried daves suggestion, but that still returns the same error -
has anyone got any other suggestions, i've never been able to get
format to work

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Formatting a TextBox on a UserForm

If you skinny down your code, can you make it work:

textbox18.value = "123.45"
Then
msgbox me.textbox18.value
then
msgbox format(1234,"#0.00")
then
msgbox format(1234,"£#,##0.00")

And you may want to share where this code is going. Is it behind the userform?

Jimbob wrote:

Hi all

I am really struggling to format a TextBox on a UserForm. I'm using
the following code on the Textbox change event, but keep getting - Run-
time error '438': Object does not support this property or method:

TextBox18.Value = Format(UserFormNewItems.TextBox18.Value,
"£#,##0.00")

I'm not experienced with 'Format' as every time i've attempted to use
it i've had similar problems. I've searched the group for a
resolution, but to no avail, i've also tried double quoting the ""£"",
but that diodn't work either

Can anyone please help

Thanks

Jim


--

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
Formatting textbox currency on userform gki[_11_] Excel Programming 2 July 27th 04 01:30 PM
Excel VBA - Userform textbox formatting thesteelmaker[_4_] Excel Programming 1 March 3rd 04 08:51 PM
Formatting userform textbox - help required Kennyatwork Excel Programming 3 February 6th 04 04:58 PM
Formatting number in a UserForm TextBox John Pierce Excel Programming 3 January 26th 04 04:57 PM
formatting text in TextBox in UserForm Kevin Excel Programming 2 November 7th 03 01:34 PM


All times are GMT +1. The time now is 09:17 AM.

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"