View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
ole_ ole_ is offline
external usenet poster
 
Posts: 30
Default Removing commandbuttons on "save as"

Bob, your a genius, ones again thanks.

and if it can comfort you i'm allmost done with my "project".

Ole


"Bob Phillips" skrev i en meddelelse
...
Okay, it was said actually, just6 didn't see it :-)

In the code just before the SaveAs, delete them. This code deletes all
shapes on a worksheet, including buttons. Just call this routine. You

might
want to chyange ACtivesheet to a named sheet, such as Worksheets("Sheet1")


'----------------------------------------------------------------
Sub RemoveShapes()
'----------------------------------------------------------------
Dim shp As Shape
Dim sTopLeft As String
Dim fOK As Boolean

For Each shp In ActiveSheet.Shapes

fOK = True

testStr = ""
On Error Resume Next
sTopLeft = shp.TopLeftCell.Address
'Autofilter and Data Validation dropdowns
'don't seem to have a topleftcell address.
On Error GoTo 0

If shp.Type = msoFormControl Then
If shp.FormControlType = xlDropDown Then
If testStsTopLeftr = "" Then
'keep it
fOK = False
End If
End If
End If

If fOK Then
shp.Delete
End If

Next shp

End Sub



--

HTH

RP
(remove nothere from the email address if mailing direct)


"ole_" wrote in message
...
I have my Pricelist.xls with the commandbuttons and when that file is

"save
as"
for exampel "march.xls" i dont want March.xls to have any commandbuttons
but they should still remain in pricelist.xls.

Ole


"Bob Phillips" skrev i en meddelelse
...
Hi Ole,

How can they not be saved, yet remain?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"ole_" wrote in message
...
Hi,

I have a XLS file called pricelist with 3 sheets and all with 14
commandbuttons, when the pricelist.xls
is "saved as" i dont want the commandbuttons to be saved only the

data,
but
they of cource still should
remain in pricelist.xls (when im finshed making it im going to make

it
to
a
XLT file)

AHA.

Ole