Link to home
Start Free TrialLog in
Avatar of Chris Pfeiffer
Chris PfeifferFlag for Japan

asked on

Cell Value to Textbox Control name

I have a the value Sheet9.tbSig.text stored in Cells(2,7)

I have am using

Public LoggedInUser as String

to store the value in Cells(2,7)


I have the following call to open an Outlook e-mail and fill in all fields.  

Public Sub Mail_Export(ByRef mTO As String, ByRef mCC As String, mSubject As String, mBody As String)

Open in new window


I am using the following all to fill this:

Call OutlookEmail.Mail_Export(cboAssignedTo.Value, Sheet9.tbEPRUpdateCC, "(FOUO) " & cboMember.Text & " EPR Update(FOUO)", Sheet9.tbFOUO.Text & vbCrLf & vbCrLf & Sheet9.tbEPRUpdateBody.Text & vbCrLf & vbCrLf & _
  LoggedInUser   & vbCrLf & vbCrLf & Sheet9.tbFOUO.Text)

Open in new window


When I use the above call for the variable LoggedInUser it uses "sheet9.tbsig1" and not the value of sheet9.tbsig1.

however when I type in the immediate window LoggedInUser = sheet9.tbsig1  the text of tbsig1 is filled into the call procedure.  Any help on how to fix this so the value of the textbox is filled into the call procedure??

Thanks.
Avatar of Rgonzo1971
Rgonzo1971

HI,

Could you show where you assign the value of LoggedInUser   in the code

Regards
Avatar of Chris Pfeiffer

ASKER

LoggedInUser = Cells(UserIndex, 6)

Open in new window

Hi,

in your question you say it comes from  Cells(2,7)

not Cells(something,6)

is that the problem?

Regards
No sorry I was just typing it from memory.  it is Cells(UserIndex,7)  
UserIndex is just a placeholder for the row of the currently logged in user.
which result gives this just before the call sub

Debug.Print TypeName(LoggedInUser)
String
When you type LoggedInUser = sheet9.tbsig1 in the immediate window you assign a textbox
to the variable not a string

then when you Mail_Export sub uses it calls the default propertiy of the object which is in this case .Value

I suppose you have in Cells(UserIndex, 7)  the string "sheet9.tbsig1" that won't work

Regards
I understand.  I just wanted to know if there was any way to pass the string to a textbox like when I type it into the immediate window?
ASKER CERTIFIED SOLUTION
Avatar of Rgonzo1971
Rgonzo1971

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the fast response.