View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default how to delete all macros - save file with cell-name

The macro DeleteAllMacros doesn't work.
Message : Methiode VBPtoject of object_workbook has
failed.

And the line : With ActiveWorkbook.VBProject is colored
yellow.
What can I do ?
Tom
-----Original Message-----
Perfect !

Can I open an xls file which name I don't know.
So I want to make a macro that opens an xls file that
will be selected by the user(browse) and than I want to
copy a sheet of this file.

Greez
Tom

-----Original Message-----
Hi Tom
Sub DeleteAllMacros()
Dim Composantvbe As Object
With ActiveWorkbook.VBProject
For Each Composantvbe In .VBComponents
If Composantvbe.Type = 100 Then
With Composantvbe.CodeModule
.DeleteLines 1, .CountOfLines
.CodePane.Window.Close
End With
Else: .VBComponents.Remove Composantvbe
End If
Next Composantvbe
End With
End Sub

To save your file with value in A1:
Activeworkbook.SaveAs "Version 1.0" &
Worksheets("YourSheet").Range("A1").Value & ".xls"

HTH
Cordially
Pascal


"Tom" a écrit

dans
le message de
.. .
Hi,

Is it possible to make a macro that deletes all

macro's?
I've got a large xls file (7MB) and I want to save

only
the fill-in cells.
I've made a macro that copies the fill-in cells to a
sheet and deletes all the others sheets.
I use an auto_open macro and after deleting the sheets
the auto_open macro cannot be played, so I have te

delete
it.

Second question : How can I save a file with the value
(name) of a cell ?
ex : A1 = TOM
I want to make a marco that saves the file as:
Version 1.0 TOM

Greez
Tom



.

.