-2

I use a Macro to fill in a Webform. So far the Macros serve my purpose. The Web forms gets text the from excel correctly.

The problem is after the form is filled in. The Web form does not recognize the text that the macro inserted. Web forms need an action from the keybord in the Web form to validate that it is not auto filled. For example, if I do anything through the keyboard in the Web form, it then sees as text, so typing space from keyboard and deleting it helps to form to be valid.

How can I use the 'delete' symbol in form? I tried getElementsByTagName and getElementsByClassname and with this to SendKeys return error. For example,

getElementsByTagName(0).SendKeys"{BACKSPACE}"

This returns an error.

Community
  • 1
  • 1
  • I have edited the same so you not knowing English is no longer a problem. The way I see your question is that macro entry to a web form is treated as spam and is not allowed to submit until a keyboard action is triggered which you are trying to do through Macro as well. You should provide additional information as to which web form you are trying to fill. As each web form validation differs. – Oasa Aug 12 '17 at 09:20
  • Thank you for help :-) Web form validation on site come with changing ClassName of input tag. Probably, ClassName change with javascript action. – footballplayer Aug 12 '17 at 09:27
  • Is it necessary to do it this way? Why not more direct? https://stackoverflow.com/questions/158633/how-can-i-send-an-http-post-request-to-a-server-from-excel-using-vba – jamheadart Aug 12 '17 at 09:32

1 Answers1

0

Prior to using SendKeys Method, you need to confirm that the window and button active is the correct one (you can also use TAB to make sure it is at the correct button) or you can use ActiveDocument.GoTo(wdGoToPage, wdGoToRelative, 0).Select and give enough time between keystrokes or the web form to be filled. And then use SendKeys ("{BACKSPACE}") . You don't need to associate SendKeys to getElementBysTagName(0) as it is not a valid method within that object. Just write it plainly

Oasa
  • 417
  • 4
  • 16
  • Here is my HTML code: `` And with HTML code i use macro: `Set inputCollection = IE.document.getElementsByTagName("input") For Each otext In inputCollection If otext .getAttribute("data-ng-model") = "text-box" Then otext .Value = "any text" otext .focus SendKeys "{BACKSPACE}" End If Next otext ` I think, this web form have an angular validation. And before doing anything from keyboard in this form, ut not valid. I try to use `otext.focus` and `SendKeys "{BACKSPACE}"`, but it do not work. – footballplayer Aug 12 '17 at 10:16
  • Sorry. I am a new member and do not know yet how to type text redable, in column. – footballplayer Aug 12 '17 at 10:24
  • Can anyone to help me? – footballplayer Aug 12 '17 at 16:05
  • use the _edit_ button at the end of your question ... where is says `share` `edit` `flag` ..... then add your code to the original question . indent code by 4 spaces to make it formatted as code .... after you do that, delete the three comments ( and i will delete this comment) – jsotola Aug 13 '17 at 01:37
  • Just checking. DId you solve or should i spend time on this. – Oasa Aug 13 '17 at 11:50