P
pnoble
I am writing a macro in Excel 2000 that begins with a template, then
generates a copy (with SaveCopyAs) as a second template specific to a
project, and finally produces a copy of the second spreadsheet without
the macro attached...but I haven't been able to remove the macro.
I created a Control Button on the spreadsheet to activate the macro of
the original template which appear again in the second generation
template. The final copy is produced with the Copy command and also
contains the button. I wrote code to delete all the procedures and
macros that were attached to this third workbook, but when I open the
workbook, it asks me the "Disable/Enable" question. If I were to delete
the buttons, would this eliminate the workbook's link to macros? As of
now, the buttons exist in the spreadsheet, but pressing them does
nothing.
The following two segments of code I found from other posts, but they
did nothing or didn't work at all:
Dim shp As Shape
For Each shp In ActiveSheet.Shapes
If shp.FormControlType = xlButtonControl Then
shp.Delete
End If
Next shp
'*********************************************
For Each B In ActiveSheet.Buttons
B.Delete
Next B
If deleting the buttons doesn't work, then how else should I make a
copy without copying over the macro? I've tried copy/pasting, but
couldn't do it between two different workbooks.
Sorry for the long-winded question. Hopefully, it's understandable. Any
suggestions are appreciated.
Thanks,
Patrick
generates a copy (with SaveCopyAs) as a second template specific to a
project, and finally produces a copy of the second spreadsheet without
the macro attached...but I haven't been able to remove the macro.
I created a Control Button on the spreadsheet to activate the macro of
the original template which appear again in the second generation
template. The final copy is produced with the Copy command and also
contains the button. I wrote code to delete all the procedures and
macros that were attached to this third workbook, but when I open the
workbook, it asks me the "Disable/Enable" question. If I were to delete
the buttons, would this eliminate the workbook's link to macros? As of
now, the buttons exist in the spreadsheet, but pressing them does
nothing.
The following two segments of code I found from other posts, but they
did nothing or didn't work at all:
Dim shp As Shape
For Each shp In ActiveSheet.Shapes
If shp.FormControlType = xlButtonControl Then
shp.Delete
End If
Next shp
'*********************************************
For Each B In ActiveSheet.Buttons
B.Delete
Next B
If deleting the buttons doesn't work, then how else should I make a
copy without copying over the macro? I've tried copy/pasting, but
couldn't do it between two different workbooks.
Sorry for the long-winded question. Hopefully, it's understandable. Any
suggestions are appreciated.
Thanks,
Patrick