Vba Text Box value issue.

needhelp2

Active Member
Joined
Apr 19, 2011
Messages
250
Hello Guys,

Today i cameup with another issue related to my last post's but still i need a little modification in kindly please assist me how can i handle it?
PFB my source Code.


Rich (BB code):
Option Explicit

Private Sub Cancel_Click()
    Unload Me
End Sub

Private Sub Submit_Click()
    Excel.Application.Cursor = xlIBeam
    LaunchGamil Me.TextBox1.Value, Me.TextBox2.Value
    Unload Me
    Excel.Application.Cursor = xlDefault
End Sub

Private Sub LaunchGamil(username As String, password As String)
    Const strURL_c As String = "http://gmail.com"
    Dim objIE As SHDocVw.InternetExplorer
    Dim ieDoc As MSHTML.HTMLDocument
    Dim tbxPwdFld As MSHTML.HTMLInputElement
    Dim tbxUsrFld As MSHTML.HTMLInputElement
    Dim btnSubmit As MSHTML.HTMLInputElement
   
    On Error GoTo Err_Hnd
    'Create Internet Explorer Object
    Set objIE = New SHDocVw.InternetExplorer
    'Navigate the URL
    objIE.Navigate strURL_c
    'Wait for page to load
    Do Until objIE.ReadyState = READYSTATE_COMPLETE: Loop
    'Get document object
    Set ieDoc = objIE.Document
    'Get username/password fields and submit button.
    Set tbxPwdFld = ieDoc.all.Item("Passwd")
    Set tbxUsrFld = ieDoc.all.Item("login")
    Set btnSubmit = ieDoc.all.Item(".save")
    'Fill Fields
    tbxUsrFld.Value = username
    tbxPwdFld.Value = password
     password=range("a1")
      username=range("a2")

 'Click submit
    btnSubmit.Click
    'Wait for transistion page to load
    Do Until objIE.ReadyState = READYSTATE_COMPLETE: Loop
    'Wait for main page to load
    Do Until objIE.ReadyState = READYSTATE_COMPLETE: Loop
Err_Hnd: '(Fail gracefully)
    objIE.Visible = True
End Sub
Kinldy tell me how i can input values to "text box1.and text box2" from range("a1),("a2") respectively, infect i had tried but its not working look my attempt in bold. I need text box values should be taken from range as defined,

Thanks in Advance.

BR,
Smith
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Try

Code:
tbxUsrFld.Value = Range("A1").Value
tbxPwdFld.Value = Range("A2").Value
 
Upvote 0
I just tried this successfully

Code:
Sub test()
With UserForm1
    .TextBox1.Value = Range("A1").Value
    .TextBox2.Value = Range("A2").Value
    .Show
End With
End Sub
 
Upvote 0
check my that view over here http://www.imageupload.org/?d=84F581441
 
Upvote 0
Shouldn't it be like this

Code:
Private Sub Submit_Click()
    Excel.Application.Cursor = xlIBeam
    Me.TextBox1.Value = Range("A1").Value
    Me.TextBox2.Value = Range("A2").Value
    LaunchGamil Me.TextBox1.Value, Me.TextBox2.Value
    Unload Me
    Excel.Application.Cursor = xlDefault
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,565
Messages
6,179,549
Members
452,927
Latest member
rows and columns

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top