+ Reply to Thread
Results 1 to 2 of 2

NEED HELP: How to code correctly an HTML element to excel vba

Hybrid View

  1. #1
    Registered User
    Join Date
    05-20-2013
    Location
    PH
    MS-Off Ver
    Excel 2003
    Posts
    4

    Post NEED HELP: How to code correctly an HTML element to excel vba

    Hi Masters,

    I'm a newbie to HTML vba coding to excel. I have my code running well in logging into a webpage that requires a login, setting my parameters of the data to be queried. The only missing part is how to code to export the data in excel.

    The webpage has an excel icon to click where it enables you to export the data queried. In this part, I really don't know how to code that to export the data and save it into xls or xlsx format.


    Here is the HTML code that I got in inspecting the element.

    [<img alt="Export to Excel" src="//shipcdn.com/Assets/Excel-icon.png" border="0" complete="complete"/>][/CODE]

    [<a href="/Bizdesk/excelExport.aspx?new=excel" target="_blank">][/CODE]

  2. #2
    Registered User
    Join Date
    05-20-2013
    Location
    PH
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: NEED HELP: How to code correctly an HTML element to excel vba

    Sorry I forgot to include my code here. I have to hide the login credentials for security reason.


    Sub GetINTdata()

    Dim ieApp As InternetExplorer
    Dim ieDoc As Object


    'create a new instance of ie
    Set ieApp = New InternetExplorer

    'you don’t need this, but it’s good for debugging
    ieApp.Visible = True


    'assume we’re not logged in and just go directly to the login page
    ieApp.Navigate "http://www.intexpress.com/BizDesk/Login.aspx"
    Do While ieApp.Busy: DoEvents: Loop
    Do Until ieApp.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop

    Set ieDoc = ieApp.Document

    'fill in the login form – View Source from your browser to get the control names
    With ieDoc.forms(0)
    .ctl00_ContentPlaceHolder1_txtUsername.Value = "xxx"
    .ctl00_ContentPlaceHolder1_txtPassword.Value = "xxx"
    .ctl00_ContentPlaceHolder1_btnSubmit.Click
    End With
    Do While ieApp.Busy: DoEvents: Loop
    Do Until ieApp.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop


    'now that we’re in, go to the page we want
    ieApp.Navigate "http://www.intexpress.com/BizDesk/AWBReport.aspx"
    Do While ieApp.Busy: DoEvents: Loop
    Do Until ieApp.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop

    'fill in the parameters of the report and filter then export the data
    With ieDoc.forms(0)
    'Account
    .ctl00_ContentPlaceHolder1_txtFilterAccount.Value = ""

    'AWB#
    .ctl00_ContentPlaceHolder1_txtFilterAWBNumber.Value = ""

    'Sender State
    .ctl00_ContentPlaceHolder1_drpFirstSenderState.Value = "CA"

    'Reciever State
    .ctl00_ContentPlaceHolder1_drpFirstRecipientState.Value = "GA"

    'Start Date (From)
    .ctl00_ContentPlaceHolder1_txtFilterStartDate.Value = "07/01/2015"

    'End Date (To)
    .ctl00_ContentPlaceHolder1_txtFilterEndDate.Value = "07/08/2015"

    'Filter Button
    .ctl00_ContentPlaceHolder1_btnFilter.Click
    End With

    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Conditional formatting not copying over correctly into body of HTML email
    By seaottr in forum Excel Programming / VBA / Macros
    Replies: 29
    Last Post: 04-10-2017, 01:01 PM
  2. HTML code To Excel : Is it possible ?
    By chaitreya in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-09-2015, 12:01 AM
  3. [SOLVED] Parsing HTML element into excel
    By chococ in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-11-2014, 05:20 PM
  4. Excel 2003 will not open html file correctly
    By RichardS in forum Excel General
    Replies: 0
    Last Post: 06-07-2006, 04:20 AM
  5. Excel 2003 does not open html file correctly
    By rdshadden in forum Excel General
    Replies: 0
    Last Post: 06-07-2006, 01:06 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1