+ Reply to Thread
Results 1 to 5 of 5

Reading From HTM Files

Hybrid View

  1. #1
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: Reading From HTM Files

    Thanks Leith,
    That's very helpful in understanding the DIR function.

    Now the original question in my post.
    I have a number of .HTM files [all in one directory].

    I can open these files with Excel and they automatically open as .xls files.
    I can access the data by referencing cells etc.

    When I try to open them from within VBA, they open as webpages and I can't access data.

    From VBA, can I force the system to use Excel to open them?

    I have sort of figured out a workaround [not implemented yet].
    I can use Name function to change the file extension from .HTM to .XLS and then open them from VBA. But I am not sure if this is the right way to approach the problem.

    Thanks again for your help.
    modytrane

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Reading From HTM Files

    Hello modytrane,

    To open the .htm file in Excel, use the Workbooks.Open method.
       WorkBooks.Open "C:\Program Files\Some.htm"
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: Reading From HTM Files

    Leith,
    When I open the .HTM file with that command, it opens as a Web Page.
    I want to open it as an excel file, so I can copy certain cells from it. Can I force Excel to open it. It works when I open it manually from the Excel program.
    Thanks,
    modytrane

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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