Hi,
I can't see what is wrong with the below code?
![]()
Dim wb As Workbook dpworkbook = ThisWorkbook.Name If wb.Name <> dpworkbook Then Application.DisplayAlerts = False wb.Close Application.DisplayAlerts = True End If
Hi,
I can't see what is wrong with the below code?
![]()
Dim wb As Workbook dpworkbook = ThisWorkbook.Name If wb.Name <> dpworkbook Then Application.DisplayAlerts = False wb.Close Application.DisplayAlerts = True End If
change "wb" to "activeworkbook" and see what happens.
Maybe:
![]()
Sub D_N_L() Dim wb As Workbook Dim dpworkbook As String dpworkbook = ThisWorkbook.Name For Each wb In Workbooks If wb.Name <> dpworkbook Then Application.DisplayAlerts = False wb.Close Application.DisplayAlerts = True End If Next wb End Sub
Thanks John - works a treat.
@ Swoop - thanks too! : )
You're welcome. Glad to help out and thanks for the feedback.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks