My Assistant
![]() ![]() |
|
|
Dec 1 2005, 12:34 PM
Post
#1
|
|
|
UtterAccess Guru Posts: 726 From: UK |
I can use this code to determine if a sheet exists in the current workbook.
Can anyone point me in the right direction for modifying it so that it could look in a different workbook? Thanks (IMG:http://www.utteraccess.com/forum/style_emoticons/default/frown.gif) Becki |
|
|
|
Dec 1 2005, 12:55 PM
Post
#2
|
|
|
UtterAccess VIP Posts: 31,413 From: NC, USA |
Hi,
try: Function SheetExists(wb As Workbook, strSheetName As String) As Boolean ' returns TRUE if the sheet exists in wb SheetExists = False On Error Resume Next SheetExists = Len(wb.Sheets(strSheetName).Name) > 0 On Error GoTo 0 End Function Then you can use it this way: If Not SheetExists(Workbooks("WorkbookName.xls"), "MySheetName") Then MsgBox "MySheetName doesn't exist!" Else MsgBox "MySheetName exist!" End If Untested! HTH Good luck |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 18th May 2013 - 10:59 AM |