View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
[email protected] itsthedude@gmail.com is offline
external usenet poster
 
Posts: 14
Default On Error GoTo .... error

Thanks for the suggestions, darren. It seems like i find a new
function (SheetExists) everyday... Going back to the original
problem, here's another situation where the error isn't catching.
This function is allowing the user to select the master file. If the
user accidentally clicks a file that is already open, the message
saying its open and asking if the user wants to replace it pops up.
If 'NO' is selected, the error occurs. It SHOULD be flagged and just
restart the routine, but, like before.... nothing.

Private Sub cmb_OpenProjectFile_Click()
Dim pfilename As Variant

On Error Resume Next
beginning:

original_workbook = ActiveWorkbook.Name
pfilename = Application.GetOpenFilename _
("Excel File (*.xls),*.xls", , "Select the file to merge")


If pfilename < False Then
If pfilename < ActiveWorkbook.Name Then
On Error Resume Next
Application.Workbooks.Open (pfilename)
If ActiveWorkbook.Name = original_workbook Then _
GoTo beginning
usf_MergeData.cbo_selectProjectFile.Text =
ActiveWorkbook.Name
usf_MergeData.cbo_selectProjectFile.AddItem
ActiveWorkbook.Name

usf_MergeData.cbo_selectProjectFile.BoundColumn = 0
End If
End If

End Sub