+ Reply to Thread
Results 1 to 4 of 4

Browse to htm file and import

  1. #1
    Forum Contributor
    Join Date
    02-03-2018
    Location
    Buckinghamshire, England
    MS-Off Ver
    2010
    Posts
    130

    Browse to htm file and import

    Hi

    Can anyone point me in the direction of some VBA to attach to a button to allow me to browse to a .HTM or .HTML file and import.

    I have found a few bits of VBA to get the filename etc. but not to import.

    Possibly I am not using a good enough search term!

    Thanks

    Neil

  2. #2
    Forum Contributor
    Join Date
    02-03-2018
    Location
    Buckinghamshire, England
    MS-Off Ver
    2010
    Posts
    130

    Re: Browse to htm file and import

    Having searched some more on the general web i found something i modified to suit. Just need to allow htm and html now

    Dim fNameAndPath As Variant, wb As Workbook
    fNameAndPath = Application.GetOpenFilename(FileFilter:="Html Files (*.HTM), *.HTM", Title:="Select File To Be Opened")
    If fNameAndPath = False Then Exit Sub
    Set wb = Workbooks.Open(fNameAndPath)

  3. #3
    Forum Contributor
    Join Date
    11-19-2015
    Location
    India
    MS-Off Ver
    excel 2013
    Posts
    124

    Re: Browse to htm file and import

    Try

    HTML Code: 

  4. #4
    Forum Contributor
    Join Date
    02-03-2018
    Location
    Buckinghamshire, England
    MS-Off Ver
    2010
    Posts
    130

    Re: Browse to htm file and import

    Hi xlHelp7

    I modified your code and it works and it allows any file to be selected.

    How can i limit it to htm and html files please.

    Neil

+ 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. Macro Required for attaching a file through Browse option in excel file
    By vikash200418 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-18-2015, 12:38 AM
  2. [SOLVED] Marco to import csv from browse location and rename current sheet without spaces or dashes
    By gutterball in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-23-2014, 09:42 AM
  3. [SOLVED] Macro to import .csv from browse for file location dialog box.
    By gutterball in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-30-2014, 08:30 AM
  4. Browse and import .csv file into new tab
    By alf40 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-29-2013, 11:22 PM
  5. Browse for excel data files to import
    By Snoopy2003 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-28-2010, 02:42 AM
  6. VBA to browse and import a .dat dile
    By Robbi_az in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-28-2008, 03:43 AM
  7. File Browse Function (Open dialog box for choosing file)
    By b-123 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-25-2005, 06:05 PM

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