View Full Version : Feed / Post Data on Web Page Using VBA
in.vaibhav
01-06-2013, 05:39 PM
Hi
Thru vba i am trying to open multiple webapage one by one & post a message in form & click submit button.
How this can be done without opening IE or with navigation option in IE.
Post command used by webpage is as follows:
<form method="POST" action="community/book_update.asp" onsubmit="return FrontPage_Form2_Validator(this)" language="JavaScript" name="
<textarea rows="5" name="np_scrap_message" cols="55"></textarea><br class="
<input type="hidden" value="97039" name="
<input type="submit" value="Leave Message" name="
</form>
Thanks
Excel Fox
01-07-2013, 09:07 AM
Vaibhav, do you want to do this without the user knowing that IE is open? Of course you have to open a web browser, although invisible!
in.vaibhav
01-07-2013, 10:01 AM
Any how will be fyne!!
Thx for reply!
Excel Fox
01-07-2013, 10:49 AM
Can you send the link to this web page? And exactly what you want to do.
in.vaibhav
01-07-2013, 11:50 AM
Hi
I am trying tp webpage one by one & then there on webpage there is a message box where i have to paste message & click on submit.
code to execute manually is submitted above.
i cant share web link since only member is allowed to login.
Thanks!!
Excel Fox
01-07-2013, 04:05 PM
The below code is just a basic way of doing a simple operation using VBA and IE. Without the actual weblink, it's hard to provide an exact solution....
Dim IE as Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate "http://www.yourwebsite.com/form.aspx"
Do Until IE.LocationURL = ""
DoEvents
Loop
Do Until IE.ReadyState = 4
DoEvents
Loop
IE.document.Forms("NameOfForm").elements("TextBox").Value = "Message Here"
IE.document.Forms("NameOfForm").elements("Submit").click
IE.Quit
End Sub
Also, search for
getElementsByTagName and
getElementByID on the net. Might give you some clue....
in.vaibhav
01-07-2013, 04:14 PM
Thanks a ton. I will check & revert on the same!!
in.vaibhav
01-07-2013, 06:53 PM
working superb, Thanks!! :)
in.vaibhav
01-07-2013, 09:39 PM
Just one more request, insted of closing IE in the end is it possible to open webpage in new TAB.
My code goes here..
Sub go()
Dim IE As Object
Dim rngRange As Range
Dim rngCell* As Range
Set IE = CreateObject("InternetExplorer.Application")
Set rngRange = Application.InputBox(prompt:="Please select a range with your Mouse.", _
Title:="SPECIFY RANGE", Type:=8)
For Each rngCell In rngRange
IE.Navigate rngCell.Value
Do Until IE.LocationURL = ""
DoEvents
Loop
'Do Until IE.ReadyState = 4
' DoEvents
'Loop
IE.Visible = True
IE.document.forms("Form1").elements("text").Value = ActiveSheet.Range("B2").Value '"Message Here"
IE.document.forms("Form1").elements("submit").Click
IE.Quit
Next rngCell
End Sub
Thansk once again.
in.vaibhav
01-08-2013, 12:59 PM
Opps one more probz..... Too many session of IE remains open in background!!
And i am getting Run Time Error 91..
Plz help!!
Thanks!
in.vaibhav
01-10-2013, 05:00 PM
hi..
any solution?
thanks!!
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.