How to capture a HTTP file path

PoggiPJ

Active Member
Joined
Mar 25, 2008
Messages
330
I need to modify an existing macro from opening and processing a pre-specified hard coded URL, to instead use the file open dialog to allow the user to select from one of several files on that web page. Basically I need to be able to set the path from the selected file name. Once the file has been selected my existing macro will continue on to copy ranges from that opened workbook.

I am having difficulty determining the correct macro code and would appreciate any help.


Code:
Sub OpenTheRoyaltyFile()

Dim StartRow            As Long
Dim LastRow             As Long
Dim Path                As String
Dim WkbImport           As Workbook
Dim wsimport            As Worksheet
Dim WSDestination       As Worksheet
Dim Cel                 As Range

    'Disable Settings
    Application.DisplayAlerts = False
    Application.EnableEvents = False
    Application.ScreenUpdating = False
    
    Path = "http://www.wmcca.org/SampleData.htm/Sales%202013Q1.xls"
    Set WkbImport = Workbooks.Open(Filename:=Path, ReadOnly:=True)

    '---------------------------------------------------------
    'Start Transfer LIH Data
    '---------------------------------------------------------
    'Initialize Variables
    Set wsimport = WkbImport.Sheets("LIH List")
    Set WSDestination = ThisWorkbook.Sheets("LIH List")
    LastRow = wsimport.Range("A" & wsimport.Rows.Count).End(xlUp).Row

I am testing using a couple of sample files on this website which is outside of our company's intranet.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,214,954
Messages
6,122,461
Members
449,085
Latest member
ExcelError

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top