Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-06-2020, 10:31 AM
PrincessApril PrincessApril is offline GetElementsByName with memo box Windows 10 GetElementsByName with memo box Office 2019
Competent Performer
GetElementsByName with memo box
 
Join Date: Nov 2019
Posts: 102
PrincessApril is on a distinguished road
Default GetElementsByName with memo box

Hi all,

I'm able to enter values into two IE form fields but not the third. I'm having trouble seeing why the same method would not work for the memo box as the textboxes. The boldfaced part of the code below is the part that does not seem to be registering. Any ideas?

Thank you in advance for any assistance you can provide!

Code:
Private Sub EmailBtnCWdown_Click()

Dim ie As Object

Set ie = CreateObject("internetexplorer.application")

ie.Visible = True

ie.Navigate ("https://mazzonicenter.freshdesk.com/support/tickets/new")

    Do Until ie.ReadyState >= 4
        DoEvents
    Loop

Set MCMemail = ie.Document.getElementsByName("helpdesk_ticket[email]")(0)
MCMemail.Value = "Testing@testing.com"

Set subj = ie.Document.getElementsByName("helpdesk_ticket[subject]")(0)
subj.Value = "Testing"

Set desc = ie.Document.getElementsByName("helpdesk_ticket[ticket_body_attributes][description_html]")(0)
desc.Value = "Testing"

End Sub

Reply With Quote
  #2  
Old 02-07-2020, 12:53 PM
PrincessApril PrincessApril is offline GetElementsByName with memo box Windows 10 GetElementsByName with memo box Office 2019
Competent Performer
GetElementsByName with memo box
 
Join Date: Nov 2019
Posts: 102
PrincessApril is on a distinguished road
Default

I'm just adding a few things for context. I don't know if memo box is the right term. It's a rich text area, so in that sense it is different than the other fields on the page.

Here is the code from the page source:

Code:
<div class="control-group " >
         <label class=" required control-label description-label " for="helpdesk_ticket_description">Description</label>
            <div class="controls   ">
               <textarea class=" required_redactor html_paragraph span12" cols="40" id="helpdesk_ticket_ticket_body_attributes_description_html" name="helpdesk_ticket[ticket_body_attributes][description_html]" rows="6">
</textarea>
I do not see an iframe anywhere on the page, so that rules out that potential problem.

After some research, I'm wondering if we have to set the focus first, but I'm not sure how to do that or if that's even the problem.

I have also tried using getElementByName but I get a 438 runtime error.

Any ideas on how to populate this description box? Thank you!
Reply With Quote
  #3  
Old 02-10-2020, 01:04 PM
PrincessApril PrincessApril is offline GetElementsByName with memo box Windows 10 GetElementsByName with memo box Office 2019
Competent Performer
GetElementsByName with memo box
 
Join Date: Nov 2019
Posts: 102
PrincessApril is on a distinguished road
Default

Hope I'm not being a bug, but just wanted to see if anyone had any ideas about this one?
Reply With Quote
  #4  
Old 02-13-2020, 08:14 PM
NoSparks NoSparks is offline GetElementsByName with memo box Windows 7 64bit GetElementsByName with memo box Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 831
NoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really nice
Default

From a Google search that took me to this page, this seems to work.
Code:
Sub FormFillTest()

    Dim ie As Object

'Open Internet Explorer
Set ie = CreateObject("internetexplorer.application")

'have it visible
ie.Visible = True

'go to the site
ie.navigate ("https://mazzonicenter.freshdesk.com/support/tickets/new")

'wait until it's loaded
    Do Until ie.ReadyState >= 4
        DoEvents
    Loop

'put email address in text box
ie.document.getElementsByName("helpdesk_ticket[email]")(0).Value = "Testing@testing.com"

'put subject in text box
ie.document.getElementsByName("helpdesk_ticket[subject]")(0).Value = "Testing"

'put something in the TEXTAREA
ie.document.getElementsByClassName("redactor_editor")(0).innerText = "Hello World"

End Sub
Reply With Quote
  #5  
Old 02-19-2020, 08:34 AM
PrincessApril PrincessApril is offline GetElementsByName with memo box Windows 10 GetElementsByName with memo box Office 2019
Competent Performer
GetElementsByName with memo box
 
Join Date: Nov 2019
Posts: 102
PrincessApril is on a distinguished road
Default

NoSparks, you are awesome.

I looked for several hours on a few days for this and just couldn't find it. And this question has stumped people in various forum threads over the years. Hopefully others will either find this thread in the future or have your intuition with the search (that was probably what was stumping me--just not searching for the right terms, but I suppose others who struggle with this might also be thinking along different lines).

Thank you again, and congrats on solving one that has proven quite tough for many!
Reply With Quote
  #6  
Old 02-19-2020, 08:36 AM
PrincessApril PrincessApril is offline GetElementsByName with memo box Windows 10 GetElementsByName with memo box Office 2019
Competent Performer
GetElementsByName with memo box
 
Join Date: Nov 2019
Posts: 102
PrincessApril is on a distinguished road
Default

ps thank you for saving me from using SendKeys
Reply With Quote
  #7  
Old 02-19-2020, 09:27 AM
NoSparks NoSparks is offline GetElementsByName with memo box Windows 10 GetElementsByName with memo box Office 2010
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 831
NoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really nice
Default

I don't know anything about this stuff.
Looked at it off and on for a couple of days thinking it should be straight forward.
I had no success looking at things in IE with my older/slower computer but once I opened the website in FireFox and used its F12 inspector it was just a matter of using the element picker and watching as I typed in that textarea.
From there did a search for how to write to a <div which got me to the page in the link.

Pleased I could help and learned something along the way.
Reply With Quote
  #8  
Old 02-20-2020, 01:48 PM
PrincessApril PrincessApril is offline GetElementsByName with memo box Windows 10 GetElementsByName with memo box Office 2019
Competent Performer
GetElementsByName with memo box
 
Join Date: Nov 2019
Posts: 102
PrincessApril is on a distinguished road
Default

Yea I think my failure was just not finding the correct combination of what to call by (name/id/class) and the element itself. I had inspected through chrome/ie and tried various combinations but did not find redactor_editor.

Thanks again so much!
Reply With Quote
Reply

Thread Tools
Display Modes


Other Forums: Access Forums

All times are GMT -7. The time now is 04:58 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft