Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Intermittent Remove Module Problem

Status
Not open for further replies.

jhartis

Chemical
Joined
Dec 12, 2001
Messages
10
Location
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top