jhartis
Chemical
- Dec 12, 2001
- 10
I am having a problem removing modules via VBA code.
code snippet...
WkBook = "Book1.xls"
ModName = "Module1"
Workbooks(WkBook).VBProject.VBComponents.Remove _ Workbooks(WkBook).VBProject.VBComponents.(ModName)
This works sometimes (especially in single step mode), but other times it doesn't. I don't get an error message either way. When it fails during single step, if I reset the code, then the module sometimes disappears.
This is part of a routine to replace many modules in many files with updated code and I can't stop the code after each deletion. Any ideas?
Thanks in advance
code snippet...
WkBook = "Book1.xls"
ModName = "Module1"
Workbooks(WkBook).VBProject.VBComponents.Remove _ Workbooks(WkBook).VBProject.VBComponents.(ModName)
This works sometimes (especially in single step mode), but other times it doesn't. I don't get an error message either way. When it fails during single step, if I reset the code, then the module sometimes disappears.
This is part of a routine to replace many modules in many files with updated code and I can't stop the code after each deletion. Any ideas?
Thanks in advance