D
deltaquattro
Hi guys,
I was dabbling with the following great piece of code, courtesy of
Chip Pearson:
Sub DeleteSheets(SheetsToKeep As Variant, _
Optional WhichWorkbook As Workbook)
Dim WB As Workbook
Dim Arr() As String
Dim N As Long
Dim V As Variant
If WhichWorkbook Is Nothing Then
Set WB = ThisWorkbook
Else
Set WB = WhichWorkbook
End If
..
..
..
And I came across the following problem: since I put all my general
subroutines in the PERSONAL.xls workbook (so that they are easily
accessed from any other project), ThisWorkbook would be PERSONAL.xls,
no matter which was the workbook from which I called DeleteSheets. I
solved this by changing
Set WB = ThisWorkbook
into
Set WB = ActiveWorkbook
I think this is the only way, if I don't want to include the Sub
DeleteSheets into each workbook which uses it. Am I right? And more
importantly, how do you manage your own Excel VBA library? Do you
store all your modules inside PERSONAL.xls or is there a better way?
Thanks,
Best Regards
deltaquattro
I was dabbling with the following great piece of code, courtesy of
Chip Pearson:
Sub DeleteSheets(SheetsToKeep As Variant, _
Optional WhichWorkbook As Workbook)
Dim WB As Workbook
Dim Arr() As String
Dim N As Long
Dim V As Variant
If WhichWorkbook Is Nothing Then
Set WB = ThisWorkbook
Else
Set WB = WhichWorkbook
End If
..
..
..
And I came across the following problem: since I put all my general
subroutines in the PERSONAL.xls workbook (so that they are easily
accessed from any other project), ThisWorkbook would be PERSONAL.xls,
no matter which was the workbook from which I called DeleteSheets. I
solved this by changing
Set WB = ThisWorkbook
into
Set WB = ActiveWorkbook
I think this is the only way, if I don't want to include the Sub
DeleteSheets into each workbook which uses it. Am I right? And more
importantly, how do you manage your own Excel VBA library? Do you
store all your modules inside PERSONAL.xls or is there a better way?
Thanks,
Best Regards
deltaquattro