excel macros "persisting"

G

Gixxer_J_97

Hi all

i am running the following code before saving and closing a workbook

************************
Worksheets(Array("Work Order", "Packing List", "Invoice", "Release",
"Shipping")).Copy
Set wkbk = ActiveWorkbook

For Each sh In wkbk.Worksheets
With sh.UsedRange
.Value = .Value
End With
Next

'DeleteAllVBA
On Error GoTo ee1
Dim VBComp As VBIDE.VBComponent
Dim VBComps As VBIDE.VBComponents

Set VBComps = ActiveWorkbook.VBProject.VBComponents

For Each VBComp In VBComps
Select Case VBComp.Type
Case vbext_ct_StdModule, vbext_ct_MSForm, vbext_ct_ClassModule
VBComps.Remove VBComp
Case Else
With VBComp.CodeModule
.DeleteLines 1, .CountOfLines
End With
End Select
Next VBComp
On Error GoTo eh4
GoTo cont
ee1:
SaveToDisk = "Error saving order." & vbLf & "Error deleting code." &
vbLf & "Contact your system administrator."
Resume finished
cont:
' END DELETE ALL VBA
' Delete all controls
Dim s
With ActiveSheet
For Each s In .Shapes
s.Delete
Next
End With

wkbk.SaveAs docpath & wonumber & ".xls"
wkbk.Close
*******************************

when i re-open this new workbook, it prompts me to enable macros. i have
looked in the vba editor and there is no code in any of the sheets. i looked
in tools -> macros and none are listed. there is only one sheet that has
control objects on it, and those are all removed.


why is it stating that there are macros still?


tia

J
 
G

Gixxer_J_97

the code that i am running removes all lines of code in the worksheets, as
well as the modules.
when i open the book and look at the vba editor there are no modules, no
forms, the only thing that is listed are the excel objects (worksheets)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top