BackOffice Products
1752580 Members
3134 Online
108788 Solutions
New Discussion юеВ

Excel macro warning

 
SOLVED
Go to solution
Antoniov.
Honored Contributor

Re: Excel macro warning

Ganesh,
I own created the excel file from new. I used a macro to make easy some works and then I removed the unique macro written. However I already checked for macro menu.

Thanks
Antonio Vigliotti
Antonio Maria Vigliotti
Marcin Golembski_1
Honored Contributor

Re: Excel macro warning

Ganesh is almost there.

Goto Tools->Macro-> Visual Basic Editor. On the left, besides 'Microsoft Excel Objects', you should also see 'Modules'. Check each object underneath 'Modules' and if there's no code written in them delete the 'Modules' branch completely. The warning message should be gone.
ganesanrajaiyan
New Member

Re: Excel macro warning

Hi,

Understood the problem, i thought of that u are using some excel workbook open event macros, and also while saving and before sending to customer you might not be delete this workbook open even macros i hope, this macro while opening the workbook it will automatically work without users permission if the macro security level is high it will ask the user to enable or disable macros

Just go to the visual basic editor and double click the "Thisworkbook" object in the left side VBAproject and insert the below code this code will do the action of while before closing your workbook this macro will delete all macro from your workbook so that now your macro workbook will be macro free workbook...

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim x As Integer
Dim Proceed As VbMsgBoxResult
Dim Prompt As String
Dim Title As String

Prompt = "Are you certain that you want to delete all the VBA Code from " & _
ActiveWorkbook.Name & "?"
Title = "Verify Procedure"

Proceed = MsgBox(Prompt, vbYesNo + vbQuestion, Title)
If Proceed = vbNo Then
MsgBox "Procedure Canceled", vbInformation, "Procedure Aborted"
Exit Sub
End If

On Error Resume Next
With ActiveWorkbook.VBProject
For x = .VBComponents.Count To 1 Step -1
.VBComponents.Remove .VBComponents(x)
Next x
For x = .VBComponents.Count To 1 Step -1
.VBComponents(x).CodeModule.DeleteLines _
1, .VBComponents(x).CodeModule.CountOfLines
Next x
End With
On Error GoTo 0

End Sub



before using this code you should take a back up of your macro file because it will erase all macros in your workbook

This macro running prerequestics is required

Tools - options - Macro settings - Trust access to the VBA project object model should be enabled

Pls let me know if any scrutiny...


Thnx
Ganesan R