![]() |
Removing modules and forms
I was given code some time ago for removing modules and forms from a file.
The code is shown below. The weird thing is that this works fine on my machine, but not on any of my colleagues. Can someone tell me why? Is there a setting I need to be aware of? On my colleagues' PCs, it gives an error on the first line. Thanks Daniel Dim VBComp As Object Dim vbMod As Object For Each vbMod In ThisWorkbook.VBProject.VBComponents ThisWorkbook.VBProject.VBComponents.Remove vbMod Next vbMod |
Removing modules and forms
Are all the same references (under tools) enabled for both machines?
-- Best Regards, Luke M *Remember to click "yes" if this post helped you!* "Daniel Bonallack" wrote: I was given code some time ago for removing modules and forms from a file. The code is shown below. The weird thing is that this works fine on my machine, but not on any of my colleagues. Can someone tell me why? Is there a setting I need to be aware of? On my colleagues' PCs, it gives an error on the first line. Thanks Daniel Dim VBComp As Object Dim vbMod As Object For Each vbMod In ThisWorkbook.VBProject.VBComponents ThisWorkbook.VBProject.VBComponents.Remove vbMod Next vbMod |
Removing modules and forms
Hi Luke,
Thanks for responding. Yes, we have the same references set regards Daniel "Luke M" wrote: Are all the same references (under tools) enabled for both machines? -- Best Regards, Luke M *Remember to click "yes" if this post helped you!* "Daniel Bonallack" wrote: I was given code some time ago for removing modules and forms from a file. The code is shown below. The weird thing is that this works fine on my machine, but not on any of my colleagues. Can someone tell me why? Is there a setting I need to be aware of? On my colleagues' PCs, it gives an error on the first line. Thanks Daniel Dim VBComp As Object Dim vbMod As Object For Each vbMod In ThisWorkbook.VBProject.VBComponents ThisWorkbook.VBProject.VBComponents.Remove vbMod Next vbMod |
Removing modules and forms
Be sure that "Microsoft Visual Basic for Applications Extesibility 5.3 is
checked in VBA ToolsReferences "Daniel Bonallack" wrote: Hi Luke, Thanks for responding. Yes, we have the same references set regards Daniel "Luke M" wrote: Are all the same references (under tools) enabled for both machines? -- Best Regards, Luke M *Remember to click "yes" if this post helped you!* "Daniel Bonallack" wrote: I was given code some time ago for removing modules and forms from a file. The code is shown below. The weird thing is that this works fine on my machine, but not on any of my colleagues. Can someone tell me why? Is there a setting I need to be aware of? On my colleagues' PCs, it gives an error on the first line. Thanks Daniel Dim VBComp As Object Dim vbMod As Object For Each vbMod In ThisWorkbook.VBProject.VBComponents ThisWorkbook.VBProject.VBComponents.Remove vbMod Next vbMod |
Removing modules and forms
Hi, yes, it was checked for all three of us.
However, I found the problem (sorry for wasting people's time). In Excel, under ToolsMacroSecurityTrusted Sources, the checkbox "Trust Access to Visual Basic Project" was checked for me, but not for my colleagues. Thanks again Daniel "JLGWhiz" wrote: Be sure that "Microsoft Visual Basic for Applications Extesibility 5.3 is checked in VBA ToolsReferences "Daniel Bonallack" wrote: Hi Luke, Thanks for responding. Yes, we have the same references set regards Daniel "Luke M" wrote: Are all the same references (under tools) enabled for both machines? -- Best Regards, Luke M *Remember to click "yes" if this post helped you!* "Daniel Bonallack" wrote: I was given code some time ago for removing modules and forms from a file. The code is shown below. The weird thing is that this works fine on my machine, but not on any of my colleagues. Can someone tell me why? Is there a setting I need to be aware of? On my colleagues' PCs, it gives an error on the first line. Thanks Daniel Dim VBComp As Object Dim vbMod As Object For Each vbMod In ThisWorkbook.VBProject.VBComponents ThisWorkbook.VBProject.VBComponents.Remove vbMod Next vbMod |
Removing modules and forms
Surprised that's all it was, what about
If vbMod.Type < 100 Then ' vbext_ct_ClassModule ' remove non book/sheet module end if Regards, Peter T "Daniel Bonallack" wrote in message ... Hi, yes, it was checked for all three of us. However, I found the problem (sorry for wasting people's time). In Excel, under ToolsMacroSecurityTrusted Sources, the checkbox "Trust Access to Visual Basic Project" was checked for me, but not for my colleagues. Thanks again Daniel "JLGWhiz" wrote: Be sure that "Microsoft Visual Basic for Applications Extesibility 5.3 is checked in VBA ToolsReferences "Daniel Bonallack" wrote: Hi Luke, Thanks for responding. Yes, we have the same references set regards Daniel "Luke M" wrote: Are all the same references (under tools) enabled for both machines? -- Best Regards, Luke M *Remember to click "yes" if this post helped you!* "Daniel Bonallack" wrote: I was given code some time ago for removing modules and forms from a file. The code is shown below. The weird thing is that this works fine on my machine, but not on any of my colleagues. Can someone tell me why? Is there a setting I need to be aware of? On my colleagues' PCs, it gives an error on the first line. Thanks Daniel Dim VBComp As Object Dim vbMod As Object For Each vbMod In ThisWorkbook.VBProject.VBComponents ThisWorkbook.VBProject.VBComponents.Remove vbMod Next vbMod |
Removing modules and forms
I thought about that, but decided they surely must have that checked. Broke
my own rule of never assuming anything unless it is to assume that it is wrong. "Daniel Bonallack" wrote: Hi, yes, it was checked for all three of us. However, I found the problem (sorry for wasting people's time). In Excel, under ToolsMacroSecurityTrusted Sources, the checkbox "Trust Access to Visual Basic Project" was checked for me, but not for my colleagues. Thanks again Daniel "JLGWhiz" wrote: Be sure that "Microsoft Visual Basic for Applications Extesibility 5.3 is checked in VBA ToolsReferences "Daniel Bonallack" wrote: Hi Luke, Thanks for responding. Yes, we have the same references set regards Daniel "Luke M" wrote: Are all the same references (under tools) enabled for both machines? -- Best Regards, Luke M *Remember to click "yes" if this post helped you!* "Daniel Bonallack" wrote: I was given code some time ago for removing modules and forms from a file. The code is shown below. The weird thing is that this works fine on my machine, but not on any of my colleagues. Can someone tell me why? Is there a setting I need to be aware of? On my colleagues' PCs, it gives an error on the first line. Thanks Daniel Dim VBComp As Object Dim vbMod As Object For Each vbMod In ThisWorkbook.VBProject.VBComponents ThisWorkbook.VBProject.VBComponents.Remove vbMod Next vbMod |
All times are GMT +1. The time now is 01:07 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com