View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
jlclyde jlclyde is offline
external usenet poster
 
Posts: 410
Default VBA open file from a form

I am trying to open a file from a userForm....When stepping through
the code; when it gets to the FileNm part where it sets the Files name
to open, it runs to the end. I am pretty sure this is not normal.
How do I get this back to where I can step through line by line with
F8? Code is below.

Thanks,
Jay

Private Sub Enter_Click()
Dim LastRow As Long
Dim FileNm As String
Dim Master As Workbook
ChDir "G:\Masters\"
LastRow = Range("A65536").End(xlUp).Row + 1

FileNm = Application.GetOpenFilename(Title:="Please choose a file
to import.", MultiSelect:=False)
Set Master = Workbooks.Open(Filename:=FileNm, ReadOnly:=True)
With Master.Sheets(1)


End With
Range("A" & LastRow).Value = Now

Unload Me
End Sub