Solved

Cell Value to Textbox Control name

Posted on 2014-04-13
10
322 Views
Last Modified: 2014-04-13
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.
0
Comment
Question by:Chris Pfeiffer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
10 Comments
 
LVL 51

Expert Comment

by:Rgonzo1971
ID: 39997187
HI,

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

Regards
0
 
LVL 2

Author Comment

by:Chris Pfeiffer
ID: 39997188
LoggedInUser = Cells(UserIndex, 6)

Open in new window

0
 
LVL 51

Expert Comment

by:Rgonzo1971
ID: 39997189
Hi,

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

not Cells(something,6)

is that the problem?

Regards
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
LVL 2

Author Comment

by:Chris Pfeiffer
ID: 39997191
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.
0
 
LVL 51

Expert Comment

by:Rgonzo1971
ID: 39997199
which result gives this just before the call sub

Debug.Print TypeName(LoggedInUser)
0
 
LVL 2

Author Comment

by:Chris Pfeiffer
ID: 39997203
String
0
 
LVL 51

Expert Comment

by:Rgonzo1971
ID: 39997209
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
0
 
LVL 2

Author Comment

by:Chris Pfeiffer
ID: 39997210
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?
0
 
LVL 51

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 39997233
Sorry No
0
 
LVL 2

Author Closing Comment

by:Chris Pfeiffer
ID: 39997241
Thanks for the fast response.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question