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.
I am testing using a couple of sample files on this website which is outside of our company's intranet.
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.