Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Delete Macro in VBA Project Office 2003

Hi

I have a VBAProject that deletes a macro in Office 2000 and is working
well.
My production server has Office 2003 and I'm using the same
VBAProject, but it does not work in Office 2003. I get an error that
my VBAProject does not have VBComponets or it is protected.

See code:

Private Sub RemoveAllMacros(ByVal objDocument Object)
Dim i As Long, l As Long
If objDocument Is Nothing Then Exit Sub
i = 0
On Error Resume Next

i = objDocument.VBProject.VBComponents.Count
On Error GoTo 0
If i < 1 Then ' no VBComponents or protected VBProject
Exit Sub
End If
With objDocument.VBProject
For i = .VBComponents.Count To 1 Step -1
On Error Resume Next
.VBComponents.Remove .VBComponents(i)
' delete the component
On Error GoTo 0
Next i
End With
With objDocument.VBProject
For i = .VBComponents.Count To 1 Step -1
l = 1
On Error Resume Next
l = .VBComponents(i).CodeModule.CountOfLines
.VBComponents(i).CodeModule.DeleteLines 1, l
' clear lines
On Error GoTo 0
Next i
End With
End Sub

I'm I missing something in Office 2003? I also set the security level
in Excel to Medium then Low.

Help, Help!!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Delete Macro in VBA Project Office 2003

Have you enabled code access to the VBE in the security settings?

--
Regards,
Tom Ogilvy

"Diehard" wrote in message
om...
Hi

I have a VBAProject that deletes a macro in Office 2000 and is working
well.
My production server has Office 2003 and I'm using the same
VBAProject, but it does not work in Office 2003. I get an error that
my VBAProject does not have VBComponets or it is protected.

See code:

Private Sub RemoveAllMacros(ByVal objDocument Object)
Dim i As Long, l As Long
If objDocument Is Nothing Then Exit Sub
i = 0
On Error Resume Next

i = objDocument.VBProject.VBComponents.Count
On Error GoTo 0
If i < 1 Then ' no VBComponents or protected VBProject
Exit Sub
End If
With objDocument.VBProject
For i = .VBComponents.Count To 1 Step -1
On Error Resume Next
.VBComponents.Remove .VBComponents(i)
' delete the component
On Error GoTo 0
Next i
End With
With objDocument.VBProject
For i = .VBComponents.Count To 1 Step -1
l = 1
On Error Resume Next
l = .VBComponents(i).CodeModule.CountOfLines
.VBComponents(i).CodeModule.DeleteLines 1, l
' clear lines
On Error GoTo 0
Next i
End With
End Sub

I'm I missing something in Office 2003? I also set the security level
in Excel to Medium then Low.

Help, Help!!!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Delete Macro in VBA Project Office 2003

How do I enable code access to the VBE?

Regards
Eugene

"Tom Ogilvy" wrote in message ...
Have you enabled code access to the VBE in the security settings?

--
Regards,
Tom Ogilvy

"Diehard" wrote in message
om...
Hi

I have a VBAProject that deletes a macro in Office 2000 and is working
well.
My production server has Office 2003 and I'm using the same
VBAProject, but it does not work in Office 2003. I get an error that
my VBAProject does not have VBComponets or it is protected.

See code:

Private Sub RemoveAllMacros(ByVal objDocument Object)
Dim i As Long, l As Long
If objDocument Is Nothing Then Exit Sub
i = 0
On Error Resume Next

i = objDocument.VBProject.VBComponents.Count
On Error GoTo 0
If i < 1 Then ' no VBComponents or protected VBProject
Exit Sub
End If
With objDocument.VBProject
For i = .VBComponents.Count To 1 Step -1
On Error Resume Next
.VBComponents.Remove .VBComponents(i)
' delete the component
On Error GoTo 0
Next i
End With
With objDocument.VBProject
For i = .VBComponents.Count To 1 Step -1
l = 1
On Error Resume Next
l = .VBComponents(i).CodeModule.CountOfLines
.VBComponents(i).CodeModule.DeleteLines 1, l
' clear lines
On Error GoTo 0
Next i
End With
End Sub

I'm I missing something in Office 2003? I also set the security level
in Excel to Medium then Low.

Help, Help!!!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Delete Macro in VBA Project Office 2003

Tools=Macro=Security, go to the Trusted sources tab and in the lower left
check "trust access to visual basic project"

--
Regards,
Tom Ogilvy

"Diehard" wrote in message
om...
How do I enable code access to the VBE?

Regards
Eugene

"Tom Ogilvy" wrote in message

...
Have you enabled code access to the VBE in the security settings?

--
Regards,
Tom Ogilvy

"Diehard" wrote in message
om...
Hi

I have a VBAProject that deletes a macro in Office 2000 and is working
well.
My production server has Office 2003 and I'm using the same
VBAProject, but it does not work in Office 2003. I get an error that
my VBAProject does not have VBComponets or it is protected.

See code:

Private Sub RemoveAllMacros(ByVal objDocument Object)
Dim i As Long, l As Long
If objDocument Is Nothing Then Exit Sub
i = 0
On Error Resume Next

i = objDocument.VBProject.VBComponents.Count
On Error GoTo 0
If i < 1 Then ' no VBComponents or protected VBProject
Exit Sub
End If
With objDocument.VBProject
For i = .VBComponents.Count To 1 Step -1
On Error Resume Next
.VBComponents.Remove .VBComponents(i)
' delete the component
On Error GoTo 0
Next i
End With
With objDocument.VBProject
For i = .VBComponents.Count To 1 Step -1
l = 1
On Error Resume Next
l = .VBComponents(i).CodeModule.CountOfLines
.VBComponents(i).CodeModule.DeleteLines 1, l
' clear lines
On Error GoTo 0
Next i
End With
End Sub

I'm I missing something in Office 2003? I also set the security level
in Excel to Medium then Low.

Help, Help!!!



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Delete Macro in VBA Project Office 2003

Just to add . . .
That is in the regular Excel Menus, not in the VBE.

--
Regards,
Tom Ogilvy

"Diehard" wrote in message
om...
How do I enable code access to the VBE?

Regards
Eugene

"Tom Ogilvy" wrote in message

...
Have you enabled code access to the VBE in the security settings?

--
Regards,
Tom Ogilvy

"Diehard" wrote in message
om...
Hi

I have a VBAProject that deletes a macro in Office 2000 and is working
well.
My production server has Office 2003 and I'm using the same
VBAProject, but it does not work in Office 2003. I get an error that
my VBAProject does not have VBComponets or it is protected.

See code:

Private Sub RemoveAllMacros(ByVal objDocument Object)
Dim i As Long, l As Long
If objDocument Is Nothing Then Exit Sub
i = 0
On Error Resume Next

i = objDocument.VBProject.VBComponents.Count
On Error GoTo 0
If i < 1 Then ' no VBComponents or protected VBProject
Exit Sub
End If
With objDocument.VBProject
For i = .VBComponents.Count To 1 Step -1
On Error Resume Next
.VBComponents.Remove .VBComponents(i)
' delete the component
On Error GoTo 0
Next i
End With
With objDocument.VBProject
For i = .VBComponents.Count To 1 Step -1
l = 1
On Error Resume Next
l = .VBComponents(i).CodeModule.CountOfLines
.VBComponents(i).CodeModule.DeleteLines 1, l
' clear lines
On Error GoTo 0
Next i
End With
End Sub

I'm I missing something in Office 2003? I also set the security level
in Excel to Medium then Low.

Help, Help!!!





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Delete Macro in VBA Project Office 2003

It's working now,thanks Tom

Regards
Eugene

"Tom Ogilvy" wrote in message ...
Tools=Macro=Security, go to the Trusted sources tab and in the lower left
check "trust access to visual basic project"

--
Regards,
Tom Ogilvy

"Diehard" wrote in message
om...
How do I enable code access to the VBE?

Regards
Eugene

"Tom Ogilvy" wrote in message

...
Have you enabled code access to the VBE in the security settings?

--
Regards,
Tom Ogilvy

"Diehard" wrote in message
om...
Hi

I have a VBAProject that deletes a macro in Office 2000 and is working
well.
My production server has Office 2003 and I'm using the same
VBAProject, but it does not work in Office 2003. I get an error that
my VBAProject does not have VBComponets or it is protected.

See code:

Private Sub RemoveAllMacros(ByVal objDocument Object)
Dim i As Long, l As Long
If objDocument Is Nothing Then Exit Sub
i = 0
On Error Resume Next

i = objDocument.VBProject.VBComponents.Count
On Error GoTo 0
If i < 1 Then ' no VBComponents or protected VBProject
Exit Sub
End If
With objDocument.VBProject
For i = .VBComponents.Count To 1 Step -1
On Error Resume Next
.VBComponents.Remove .VBComponents(i)
' delete the component
On Error GoTo 0
Next i
End With
With objDocument.VBProject
For i = .VBComponents.Count To 1 Step -1
l = 1
On Error Resume Next
l = .VBComponents(i).CodeModule.CountOfLines
.VBComponents(i).CodeModule.DeleteLines 1, l
' clear lines
On Error GoTo 0
Next i
End With
End Sub

I'm I missing something in Office 2003? I also set the security level
in Excel to Medium then Low.

Help, Help!!!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Office Project vs. Office Web Component ITmidget Excel Worksheet Functions 0 February 22nd 10 04:21 PM
dont delete excel 2003 when installing office 2007 Xavier[_2_] Setting up and Configuration of Excel 2 January 25th 08 07:32 AM
Merging excel office data into a publisher office project(Australi Shirl New Users to Excel 0 April 16th 06 09:17 AM
How do i delete a macro in Excel 2003 when delete isn't highlight Abel Excel Discussion (Misc queries) 2 September 13th 05 04:09 AM
Programmatically delete macro using a protected project John Cole, Jr. Excel Programming 1 November 14th 04 04:22 PM


All times are GMT +1. The time now is 09:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"