Reputation: 1531
I've created a function which checks if a sheet exists in an external workbook. Code as follows (I've checked this and this works perfectly with other sheets, commenting out the If
statement that references this stops the error):
Function ExtSheetExists(formString) As Boolean
Dim val As Variant
On Error Resume Next
val = ExecuteExcel4Macro(formString)
ExtSheetExists = (val <> Error(2023))
On Error GoTo 0
End Function
Note: FormString
is passed as "'" & wkBookRef1 & firstShtName & "'!" & "R6C12"
where wkBookRef1
is just the path to the spreadsheet and firstShtName
is the spreadsheet name that is being looked up.
However later when I go to update the same spreadsheet using the UpdateLink
method it pops up the Select Sheet dialogue box and thus stops the run of the macro. Does anyone have an inkling as to what is going on here?
The select sheet box is as follows:
Upvotes: 0
Views: 258
Reputation: 1531
It's a bug. Effectively the formstring
is run and the message box is suppressed. However it seems that it remains as a latent process in the other spreadsheet. So when it is updated it shows the suppressed message box.
Upvotes: 0