Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862


    Quote Originally Posted by rpeare View Post
    Did you try either of the suggestions made by Itsme or me?

    1. Parsing the HTML with filesystemobject and pulling out the records
    2. Use filesystemobject to remove the section of HTML you don't want
    Using filesystemobject will there be any option to identify any contents of the file other than by char or by line?

  2. #17
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    I'm not sure what you mean by the question Itsme.

  3. #18
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by rpeare View Post
    I'm not sure what you mean by the question Itsme.
    If you open the HTM or HTML file from Access, using filesystemobject, how will you read it? I imagine being limited to reading each character and being able to identify each line feed. I am not aware of any further advantages. For me, it can be easier to parse data with HTML tags using Internet Explorer. This way, you can quickly manage entire HTML elements and their subsets.

    It is not the most straight forward thing to interact with an HTML DOM, however, I see distinct advantages in doing so.

  4. #19
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Well I hadn't considered any other way of parsing it other than filesystemobject. I rely on it pretty heavily to parse all kinds of files and really haven't ever had an issue with it.

    For instance I have:

    1. unix files where the EOL character is just a line feed (instead of a carriage return/line feed pair)
    2. files where the EOL character maybe any text based character (~,|, etc.). I parse the delimiter based on the file content and using that to denote the line break then parse the entire file into an array of individual lines, then parse line into it's sub elements and the sub elements have a text based character (:, *, etc) as their delimiter as well.
    3. regular old carriage return/line feed, comma delimited type files and haven't ever encountered something I couldn't parse this way.

    Some files I deal with all meet requirements but use more than 1 of the methods above to denote line/field delimiters so I have to have something a bit more flexible.

  5. #20
    lonesoac0 is offline Advanced Beginner
    Windows 7 32bit Access 2013
    Join Date
    Aug 2014
    Posts
    36
    Hey guys,

    I thought you would like to see my progress. Let me know if you have any suggestions! And thank you for your assistance. I would have never figured it out without you.
    Code:
    Sub ImportSDTicketStats()
    
    Dim fs
    Dim sFileName
    Dim fIn
    Dim fOut
    
    
    Set fs = CreateObject("Scripting.filesystemobject")
    sFileName = "YesterdaysTicketStatsGeneratedToday - " & Format(Date, "yyyymmdd") & "0700.htm"
    
    If Dir("\\server\departments\HelpDesk\Reporting\SDTicketClosuresforyesterday\" & sFileName) = "" Then
         MsgBox "Report was generated at 701am today."
    '----------------------------------
    sFileName01 = "YesterdaysTicketStatsGeneratedToday - " & Format(Date, "yyyymmdd") & "0701.htm"
    Set fIn = fs.opentextfile("\\server\departments\HelpDesk\Reporting\SDTicketClosuresforyesterday\" & sFileName01)
    Set fOut = fs.createtextfile("\\server\departments\HelpDesk\Reporting\SDTicketClosuresforyesterday\" & Replace(sFileName01, ".htm", "_converted.htm"))
    Do While fIn.atendofstream <> True
        sline = fIn.readline
        fOut.writeline sline
        If InStr(sline, "<table cellpadd") > 0 Then
            Do Until InStr(sline, "</tr>") > 0
                sline = fIn.readline
            Loop
        End If
    Loop
    '------------------------------
    Else
         MsgBox "Report was generated at 700am today."
    '--------------------------------
    Set fIn = fs.opentextfile("\\server\departments\HelpDesk\Reporting\SDTicketClosuresforyesterday\" & sFileName)
    Set fOut = fs.createtextfile("\\server\departments\HelpDesk\Reporting\SDTicketClosuresforyesterday\" & Replace(sFileName, ".htm", "_converted.htm"))
    Do While fIn.atendofstream <> True
        sline = fIn.readline
        fOut.writeline sline
        If InStr(sline, "<table cellpadd") > 0 Then
            Do Until InStr(sline, "</tr>") > 0
                sline = fIn.readline
            Loop
        End If
    Loop
    '-------------------------------
    End If
    
    
    End Sub

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. How to use html tag <a>?
    By Corey in forum Modules
    Replies: 2
    Last Post: 08-10-2015, 02:17 PM
  2. HTML in VBA - faster way?
    By Ruegen in forum Programming
    Replies: 2
    Last Post: 12-11-2013, 08:52 PM
  3. HTML and VBA
    By tylerg11 in forum Forms
    Replies: 1
    Last Post: 08-23-2012, 05:53 PM
  4. ODBC Html
    By trenta7 in forum Import/Export Data
    Replies: 1
    Last Post: 02-08-2011, 08:55 AM
  5. HTML E-mail Using VBA
    By graviz in forum Programming
    Replies: 1
    Last Post: 12-09-2009, 08:52 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums