Quentonbailey
New Member
- Joined
- Nov 20, 2015
- Messages
- 1
Hi, I'm completely new to Vba, just starting playing around with it this week. My job is heavy with data entry and I'm trying to be a little more efficient. I have contact lists that live on excel spreadsheets that need to be transferred to web form and the only way of doing it is one at a time. I'm having 2 issues, the first is on the web form the name of the "email_address" element is not working and I'm constantly getting an error. And second, once I get past that, I have no idea how to get Vba to continuously repeat the process down a list.
What I have so far is below.
Sub FillInternetForm()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
'create new instance of IE. use reference to return current open IE if
'you want to use open IE window. Easiest way I know of is via title bar.
IE.Navigate "http://online.outdoors.org/site/c.gsJMKZPGJrH/b.8729017/k.9BFB/NY_Contact_Form/apps/ka/ct/contactus.asp?c=gsJMKZPGJrH&b=8729017&en=7gLDKONrF6JMLYPuG5LJIUNEJhLGLWMGJhLOJWPEJqJ3E"
'go to web page listed inside quotes
IE.Visible = True
While IE.Busy
DoEvents 'wait until IE is done loading page.
Wend
myVar = IE.document.Title
IE.document.ALL("first_name").Value = ThisWorkbook.Sheets("sheet1").Range("a1")
Application.Wait Now + TimeValue("00:00:01")
IE.document.ALL("last_name").Value = ThisWorkbook.Sheets("sheet1").Range("b1")
Application.Wait Now + TimeValue("00:00:01")
IE.document.ALL("email_address").Value = ThisWorkbook.Sheets("sheet1").Range("c1")
Application.Wait Now + TimeValue("00:00:01")
IE.document.ALL("zip").Value = ThisWorkbook.Sheets("sheet1").Range("d1")
Application.Wait Now + TimeValue("00:00:01")
IE.document.ALL("SubmitButton").Click
While IE.Busy
DoEvents 'wait until IR is done loading page.
Wend
IE.Navigate "http://online.outdoors.org/site/c.gsJMKZPGJrH/b.8729017/k.9BFB/NY_Contact_Form/apps/ka/ct/contactus.asp?c=gsJMKZPGJrH&b=8729017&en=7gLDKONrF6JMLYPuG5LJIUNEJhLGLWMGJhLOJWPEJqJ3E"
'go to web page listed inside quotes
IE.Visible = True
While IE.Busy
DoEvents 'wait until IE is done loading page.
Wend
End Sub
What I have so far is below.
Sub FillInternetForm()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
'create new instance of IE. use reference to return current open IE if
'you want to use open IE window. Easiest way I know of is via title bar.
IE.Navigate "http://online.outdoors.org/site/c.gsJMKZPGJrH/b.8729017/k.9BFB/NY_Contact_Form/apps/ka/ct/contactus.asp?c=gsJMKZPGJrH&b=8729017&en=7gLDKONrF6JMLYPuG5LJIUNEJhLGLWMGJhLOJWPEJqJ3E"
'go to web page listed inside quotes
IE.Visible = True
While IE.Busy
DoEvents 'wait until IE is done loading page.
Wend
myVar = IE.document.Title
IE.document.ALL("first_name").Value = ThisWorkbook.Sheets("sheet1").Range("a1")
Application.Wait Now + TimeValue("00:00:01")
IE.document.ALL("last_name").Value = ThisWorkbook.Sheets("sheet1").Range("b1")
Application.Wait Now + TimeValue("00:00:01")
IE.document.ALL("email_address").Value = ThisWorkbook.Sheets("sheet1").Range("c1")
Application.Wait Now + TimeValue("00:00:01")
IE.document.ALL("zip").Value = ThisWorkbook.Sheets("sheet1").Range("d1")
Application.Wait Now + TimeValue("00:00:01")
IE.document.ALL("SubmitButton").Click
While IE.Busy
DoEvents 'wait until IR is done loading page.
Wend
IE.Navigate "http://online.outdoors.org/site/c.gsJMKZPGJrH/b.8729017/k.9BFB/NY_Contact_Form/apps/ka/ct/contactus.asp?c=gsJMKZPGJrH&b=8729017&en=7gLDKONrF6JMLYPuG5LJIUNEJhLGLWMGJhLOJWPEJqJ3E"
'go to web page listed inside quotes
IE.Visible = True
While IE.Busy
DoEvents 'wait until IE is done loading page.
Wend
End Sub