VBA error excel to website submission

vinniehnk

New Member
Joined
Apr 11, 2012
Messages
7
Hello all,

What I am trying to do is to take several parts of data from an excel sheet and move them to a ticketing system we use to log tickets. So far i have:

Sub Fill_Form()
Set IE = CreateObject("InternetExplorer.Application")
With IE
.Visible = True
' im using facebook as an example
.navigate URL:="http://www.facebook.com"
Do Until .readystate = 4
DoEvents
Loop
Set mytextfield1 = .document.all.Item("Email")
mytextfield1.Value = Sheets("test_vba").Range("a1").Value
Set mytextfield1 = .document.all.Item("Pass")
mytextfield1.Value = Sheets("test_vba").Range("a2").Value
End With
End Sub

So far, I have encountered several issues. First, being that I have encountered an Automation error, the object invoked has disconnected from its client

I have looked it up on the web and what I am getting is i need to add an "option explicit" however, i am very basic with code and have no clue what the code would look like after adding that. I cannot figure out the variables aspect of the option explicit

. Also i would need to expand it to allow more data, so if you can give me pointers that way too it would be helpful
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
"Option Explicit"

should be typed into the (General) Declarations part of a VBA Module
It states that all Variables have to be declared before use!

Your routine with declarations

Code:
Sub Fill_Form()
 
Dim IE As Object
Dim MyTextField1 As Object
 
Set IE = CreateObject("InternetExplorer.Application")
    
With IE
    .Visible = True
    ' im using facebook as an example
    .navigate [URL="http://www.mrexcel.com/forum/="http://www.BBC.co.UK/News"]URL:="http://www.BBC.co.UK/News[/URL]"
    Do Until .readystate = 4
        DoEvents
    Loop
    
    Set MyTextField1 = .document.all.Item("Email")
    MyTextField1.Value = Sheets("test_vba").Range("a1").Value
    
    Set MyTextField1 = .document.all.Item("Pass")
    MyTextField1.Value = Sheets("test_vba").Range("a2").Value
End With
IE.Close
Set IE = Nothing
Set MyTextField1 = Nothing
End Sub
 
Upvote 0
Charles, thank you! That makes perfect sense now that i can compare apples to apples. Im still getting the error, so im thinking my IT might have a hand in blocking this. I'll check with them
 
Upvote 0
Ok, Im still stumped. That code works perfect on any site, EXCEPT our local intranet sites. The only variable that I can see is our intranet sites are Protected Mode: Off where external sites are On. Ive worked wth our IT guy who says we cant modify this and that his research indicated an error with Active X controls. Is this a possibility? If so can i possibly add a variable to handle that?

Also, on the off chance I have to use sendkeys, where would you recommend starting? ive spent days on the google search responses and nothing seems to be relevant to my issue?
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

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