View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
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?