Error de automatización código VBA excel para web
Tengo el un problema en el código para rellenar un formulario web desde excel (Código lo baje de internet) pero no me funciona me da el siguiente error 462 error de automatización.
Option Explicit
Option Private Module
Private xDat As String
Private xPath As String
Public m As Integer
#If VBA7 And Win64 Then
Private Declare PtrSafe Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
Private Declare PtrSafe Function GetShortPathName Lib "kernel32.dll" Alias "GetShortPathNameA" (ByVal lpszShortPath As String, ByVal lpszLongPath As String, ByVal cchBuffer As Long) As Long
#Else
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
Private Declare Function GetShortPathName Lib "kernel32.dll" Alias "GetShortPathNameA" (ByVal lpszShortPath As String, ByVal lpszLongPath As String, ByVal cchBuffer As Long) As Long
#End If
Sub RellenarFormWEB()
'www.excelminiapps.com
'Este codigo sirve para rellenar un formulario web con el methodo GetElement
Dim IE As Object
'creamos el objeto para el navegador Internet Explorer
Set IE = CreateObject("InternetExplorer.application")
'dentro del navegador de internet explorer, accedemos a la página donde esta el formulario HTML
'en la celda D5 esta la dirección
IE.Navigate "https://accounts.google.com/SignUp"
Do
DoEvents
Loop Until IE.readystate = 4 'verifico si cargo correctamente la página
'Completo los elementos del formulario por ID
IE.Document.getElementById("FirstName").Value = "Juan"
IE.Document.getElementById("LastName").Value = "Pablo"
'Ahora ubico el boton de submit o enviar, en este caso:
IE.Document.getElementById("submitbutton").Click
'finalmente hacemos visible la ventana de Internet Explorer
IE.Visible = True
End Sub