Consulting

Results 1 to 6 of 6

Thread: Solved: is it possible to make connection between vba and site on the internet?

  1. #1

    Question Solved: is it possible to make connection between vba and site on the internet?

    is it possible to make connection between vba and site on the internet?
    example: by print the data in cells to the textbox on the site

  2. #2
    I found this code but it's only open the site example google, so how to print data in cell or range in sheet to the Textbox google
    [VBA]Dim upcCode
    Dim myTextField As Object
    upcCode = "0001234512345"
    Set appIE = CreateObject("INTERNETEXPLORER.APPLICATION")
    appIE.navigate "http://google.com"
    appIE.Visible = True
    Do While appIE.busy[/VBA]

  3. #3
    I tried this way but didn't success .. I don't if the code mistake or the name of textbox of google mistake.
    [vba]Dim upcCode
    Dim myTextField As Object
    upcCode = "0001234512345"
    Set appie = CreateObject("INTERNETEXPLORER.APPLICATION")
    appie.navigate "http://google.com"
    appie.Visible = True
    appie.document("Search").Value = Sheets(1).Range("a6").Value
    [/vba]

  4. #4
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Try a search on the site here or on Google. Here's one I found which may assist.
    An examination of this code by Oorang may point you in the right direction.

    [VBA]Public Sub LaunchGamil()
    Const strURL_c As String = "http://mail.google.com"
    Const strUsr_c As String = "MyName"
    Const strPwd_c As String = "ABC123"
    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("Email")
    Set btnSubmit = ieDoc.all.Item("signIn")
    'Fill Fields
    tbxUsrFld.Value = strUsr_c
    tbxPwdFld.Value = strPwd_c
    'Click submit
    btnSubmit.Click
    'Wait for page to load
    Do Until objIE.ReadyState = READYSTATE_COMPLETE: Loop
    Err_Hnd: '(Fail gracefully)
    objIE.Visible = True
    End Sub
    [/VBA]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  5. #5
    it show me this error for this line : User-defined type not defined

    [vba]Dim objIE As SHDocVw.InternetExplorer[/vba]

    both of the codes are very complicated to me I'm very beginner
    Last edited by Nader; 02-21-2011 at 06:18 PM.

  6. #6
    this code succeed with me

    [vba]Set appie = CreateObject("INTERNETEXPLORER.APPLICATION")
    appie.navigate "http://google.com"
    appie.Visible = True
    Do While appie.busy
    DoEvents
    Loop
    appie.document.all.Item("q").Value = "vbaexpress"[/vba]
    thank you for help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •