Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski 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
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor