I'd suggest the following, to enhance (or at least, in my system - Autocad 2010 and W7 - it works) this great Robert Bell work
just after 'Option Explicit' codeline place
- '-------------------------------------' to prevent the main routine from acting when user only switched from one Layout to anotherDim JustSwitched As IntegerPrivate Sub AcadDocument_LayoutSwitched(ByVal LayoutName As String) JustSwitched = 1End Sub'-------------------------------------
and, just after the 'If CommandName = "LAYOUT_CONTROL" Then' codeline, place
- '----------------------- ' if only switching between Layouts, then do nothing If JustSwitched = 1 Then JustSwitched = 0 Exit Sub End If '-----------------------
while, as for the trailing zeros issue, following dbroada's advice just subsitute
- If Layout.ModelType = False Then Layout.Name = prefixName & CStr(startNum + Layout.TabOrder)
with
- If Layout.ModelType = False Then Layout.Name = prefixName & CStr(Format(startNum + Layout.TabOrder, "00")) ' keep trailing zeros
finally I didn't bumped into the "screwing up" issue while unloading the VBA script. maybe what above fixes it, or maybe I only have to witi a little bit...
PS: couldn't catch the reason why there are two 'For Each Layout In Layouts' loops both changing layouts name in a different manner. I guess one have to choose one of them and comment the other? |