Hi,
I am trying to delete a worksheet if it already exists, but the warnings will not shut off. Below is the code that I have used:
For Each Worksheet In objBook.Worksheets
With Worksheet
If .Name = strCountryID Then
DoCmd.SetWarnings False
.Delete
DoCmd.SetWarnings True
End If
End With
Next
I would also like to be able to do the same thing if a file already exists; but can't get that to work either.
Suggestions?
Thanks,
Tyler
I am trying to delete a worksheet if it already exists, but the warnings will not shut off. Below is the code that I have used:
For Each Worksheet In objBook.Worksheets
With Worksheet
If .Name = strCountryID Then
DoCmd.SetWarnings False
.Delete
DoCmd.SetWarnings True
End If
End With
Next
I would also like to be able to do the same thing if a file already exists; but can't get that to work either.
Suggestions?
Thanks,
Tyler