Open second Excel file with VBA
Dave Peterson wrote:
I'd use:
sheetName = ActiveWorkbook.ActiveSheet.Name
set ws = nothing
on error resume next
Set ws = xlTmp.Sheets(sheetName)
on error goto 0
If ws is nothing Then
Great, it works! But what's the meaning of "On Error GoTo 0" here? It appears the only error I need to look out for is that sheetName is out of range.
Gustaf
|