none
whats VBA code/object to access the menu component on a webpage? RRS feed

  • Question

  • Sub login() Dim IE As Object Dim HTMLDoc As Object, HTMLDoc2 As Object, HTMLDoc3 As Object Dim objCollection As Object Const navOpenInNewTab = &H800 Set IE = CreateObject("InternetExplorer.Application") IE.Visible = True IE.Navigate "https://athenanet.athenahealth.com/1/19/login.esp" Do While IE.Busy Or IE.ReadyState <> 4: Loop Set HTMLDoc = IE.Document With HTMLDoc HTMLDoc.getElementById("USERNAME").Value = "xxxx" 'Entering credential HTMLDoc.getElementById("PASSWORD").Value = "yyyy" End With Set objCollection = IE.Document.getElementById("loginbutton") objCollection.Click Do While IE.Busy Or IE.ReadyState <> 4: Loop ' opening the second webpage Set HTMLDoc2 = IE.Document With HTMLDoc2 HTMLDoc2.getElementById("DEPARTMENTID").selectedindex = 23 HTMLDoc2.getElementById("DEPARTMENTID").FireEvent ("onchange") HTMLDoc2.getElementById("DEPARTMENTID").selectedindex = 40 'Selecting the first index item on second page HTMLDoc2.getElementById("DEPARTMENTID").FireEvent ("onchange") End With Set objCollection = IE.Document.getElementById("loginbutton") objCollection.Click

    Do While IE.Busy Or IE.ReadyState <> 4: Loop Set HTMLDoc3 = IE.Document With HTMLDo3 HTMLDoc3.getElementById("reportsmenucomponent").Click 'Selecting the menu item End With End Sub

    I am not sure about menu item...which object should I use?? The code with HtmlDoc3 The menu item is on the third webpage.


    Thursday, June 9, 2016 8:18 PM

All replies

  • I am unable to attach the image of the webpage with the developer tab:

    this is what it looks like for report menu:

    <div class="menucomponent" id="reportsmenucomponent" name="Reports" onclick="OpenMenu({ &quot;MENUNAME&quot;: &quot;reports&quot;, &quot;MENUOBJ&quot;: { &quot;MENUNAME&quot;: &quot;Reports&quot;, &quot;COLUMNS&quot;: [ { &quot;CATEGORIES&quot;: [ { &quot;ITEMS&quot;: [ { &quot;ITEMONCLICK&quot;: &quot;&quot;, &quot;ITEMTARGET&quot;: &quot;Main&quot;, &quot;ITEMURL&quot;: &quot;/reports/sentinel/dashboard.esp#/overview/providergroup.name&quot;, &quot;ITEMTEXT&quot;: &quot;Sentinel Metrics Dashboard&quot;  } ], &quot;TITLE&quot;: &quot;&quot;  }, { &quot;ITEMS&quot;: [ { &quot;ITEMONCLICK&quot;: &quot;&quot;, &quot;ITEMTARGET&quot;: &quot;Main&quot;, &quot;ITEMURL&quot;: &quot;/reports/reportlibrary.esp&quot;, &quot;VENDORSHORTCUTKEYS&quot;: &quot;el&quot;, &quot;ITEMTEXT&quot;: &quot;Report Library&quot;  }, { &quot;ITEMONCLICK&quot;: &quot;&quot;, &quot;ITEMTARGET&quot;: &quot;Main&quot;, &quot;ITEMURL&quot;: &quot;/reports/genericreportwizard.esp&quot;, &quot;VENDORSHORTCUTKEYS&quot;: &quot;er&quot;, &quot;ITEMTEXT&quot;: &quot;Report Builder&quot;  }, { &quot;ITEMONCLICK&quot;: &quot;&quot;, &quot;ITEMTARGET&quot;: &quot;ScheduleNav&quot;, &quot;ITEMURL&quot;: &quot;/reports/reportinbox.esp&quot;, &quot;VENDORSHORTCUTKEYS&quot;: &quot;ei&quot;, &quot;ITEMTEXT&quot;: &quot;Report Inbox&quot;  } ], &quot;TITLE&quot;: &quot;General&quot;  }, { &quot;ITEMS&quot;: [ { &quot;ITEMONCLICK&quot;: &quot;&quot;, &quot;ITEMTARGET&quot;: &quot;Main&quot;, &quot;ITEMURL&quot;: &quot;/reports/arwizard.esp?REPORTTYPE=ACTIVITY&amp;SHOWVIEW=Simple&quot;, &quot;VENDORSHORTCUTKEYS&quot;: &quot;ea&quot;, &quot;ITEMTEXT&quot;: &quot;Activity Wizard&quot;  }, { &quot;ITEMONCLICK&quot;: &quot;&quot;, &quot;ITEMTARGET&quot;: &quot;Main&quot;, &quot;ITEMURL&quot;: &quot;/reports/arwizard.esp?REPORTTYPE=AGING&amp;SHOWVIEW=Simple&quot;, &quot;VENDORSHORTCUTKEYS&quot;: &quot;ew&quot;, &quot;ITEMTEXT&quot;: &quot;Accounts Receivable Aging Wizard&quot;  }, { &quot;ITEMONCLICK&quot;: &quot;&quot;, &quot;ITEMTARGET&quot;: &quot;Main&quot;, &quot;ITEMURL&quot;: &quot;/reports/timeofservicepayment_summary.esp&quot;, &quot;VENDORSHORTCUTKEYS&quot;: &quot;et&quot;, &quot;ITEMTEXT&quot;: &quot;Time-Of-Service Payment Summary&quot;  }, { &quot;ITEMONCLICK&quot;: &quot;&quot;, &quot;ITEMTARGET&quot;: &quot;Main&quot;, &quot;ITEMURL&quot;: &quot;/reports/collectionsreport.esp&quot;, &quot;VENDORSHORTCUTKEYS&quot;: &quot;eo&quot;, &quot;ITEMTEXT&quot;: &quot;Collections Accounts Receivable&quot;  }, { &quot;ITEMONCLICK&quot;: &quot;&quot;, &quot;ITEMTARGET&quot;: &quot;Main&quot;, &quot;ITEMURL&quot;: &quot;/reports/depositsactivitywizardnew.esp&quot;, &quot;VENDORSHORTCUTKEYS&quot;: &quot;ef&quot;, &quot;ITEMTEXT&quot;: &quot;Financial Controls Center Deposits Detail&quot;  }, { &quot;ITEMONCLICK&quot;: &quot;&quot;, &quot;ITEMTARGET&quot;: &quot;Main&quot;, &quot;ITEMURL&quot;: &quot;/reports/allowedtracker.esp?REPORTTYPE=PAYMENTMISMATCH&quot;, &quot;VENDORSHORTCUTKEYS&quot;: &quot;em&quot;, &quot;ITEMTEXT&quot;: &quot;Payment Mismatch Tracking &quot;  } ], &quot;TITLE&quot;: &quot;Financials&quot;  }, { &quot;ITEMS&quot;: [ { &quot;ITEMONCLICK&quot;: &quot;&quot;, &quot;ITEMTARGET&quot;: &quot;Main&quot;, &quot;ITEMURL&quot;: &quot;/client/episodeobedd.esp&quot;, &quot;ITEMTEXT&quot;: &quot;OB Episode: Estimated Delivery Date&quot;  }, { &quot;ITEMONCLICK&quot;: &quot;&quot;, &quot;ITEMTARGET&quot;: &quot;Main&quot;, &quot;ITEMURL&quot;: &quot;/client/episodeobdelivery.esp&quot;, &quot;ITEMTEXT&quot;: &quot;OB Episode: Delivery&quot;  }, { &quot;ITEMONCLICK&quot;: &quot;&quot;, &quot;ITEMTARGET&quot;: &quot;Main&quot;, &quot;ITEMURL&quot;: &quot;/client/episodeobenrollment.esp&quot;, &quot;ITEMTEXT&quot;: &quot;OB Episode: Enrollment&quot;  } ], &quot;TITLE&quot;: &quot;Specialty Reports&quot;  }, { &quot;ITEMS&quot;: [ { &quot;ITEMONCLICK&quot;: &quot;OpenPOPPages&quot;, &quot;ITEMTARGET&quot;: &quot;&quot;, &quot;ITEMURL&quot;: &quot;/Home/Index&quot;, &quot;ITEMTEXT&quot;: &quot;Population Overview&quot;, &quot;STITCHFIRST&quot;: 1  }, { &quot;ITEMONCLICK&quot;: &quot;OpenPOPPages&quot;, &quot;ITEMTARGET&quot;: &quot;&quot;, &quot;ITEMURL&quot;: &quot;/Reports&quot;, &quot;ITEMTEXT&quot;: &quot;Report List&quot;, &quot;STITCHFIRST&quot;: 1  } ], &quot;TITLE&quot;: &quot;Population Management&quot;  } ]  } ]  }  });">Reports</div>

    I want to select the report menu and then an item activitywizard within the menu component

    Thursday, June 9, 2016 8:23 PM
  • We can't login and no one can read the webpage.  Why don't you save the webpage (cntl+s) to disk and post the webpage to a file sharing site and be sure to post the files directory.  I don't use IE.  I use Selenium Basic.  Refer to this posting.

    • Edited by mogulman52 Thursday, June 9, 2016 10:38 PM
    Thursday, June 9, 2016 9:48 PM
  • Hi, 

    I have shared the file here: http://stackoverflow.com/questions/37752855/unable-to-opening-a-menu-item-vba-code?noredirect=1#comment62981945_37752855

    Saturday, June 11, 2016 2:23 PM
  • Unless we can see webpage in a browser we can't help.  When I said save webpage I meant the website.  If you use IE do Cntl+s and save as html and whole website to an empty directory.  You will have an html file and a directory.  After you saved it double click on html file and see it opens in a browser.  If it does post file and directory on file sharing site like dropbox or onedrive.  Make sure we can see it.
    Saturday, June 11, 2016 11:00 PM