Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Function Argument

Try something like

Function Test(TBX As MSForms.TextBox) As String
Test = TBX.Text
End Function

You can then call this with code like

MsgBox Test(Me.TextBox1)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"asmenut" wrote in message
...
How would one go about creating a funtion that I can use a

textbox as the
argument?



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Function Argument

You are never assigning a value to the Function, so it doesn't
return a value. You need some code in the function like

Initials = SInit


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"asmenut" wrote in message
...
Thanks. But when I plug in the function procedure, it doesn't

work (See
below)
Am I asking it to do too much?

Function Initials(SName As msForms.TextBox) As String
Dim SInit As String
Dim j As Long
Dim sLetter As String

SInit = Left(SName, 1)
j = 1
While j 0
j = InStr(j, SName, " ")
If j Then
SInit = SInint & Mid(SName, j + 1, 1)
j = j + 1
End If
Wend
End Function


"Chip Pearson" wrote:

Try something like

Function Test(TBX As MSForms.TextBox) As String
Test = TBX.Text
End Function

You can then call this with code like

MsgBox Test(Me.TextBox1)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"asmenut" wrote in

message
...
How would one go about creating a funtion that I can use a

textbox as the
argument?






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
Text Function 2nd argument Gene Excel Worksheet Functions 10 November 8th 08 11:42 PM
How can I get around 30 argument limit of SUM function? Randy Excel Worksheet Functions 4 May 9th 07 09:05 PM
Need Function Argument pasekm Excel Worksheet Functions 4 March 18th 06 11:14 PM
text as an argument of SUM function katarina07 Excel Worksheet Functions 2 October 27th 05 01:59 PM
Pop-up function argument list DMc Excel Programming 0 June 28th 04 05:13 AM


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