Replace module with code

M

Michael Wise

I want to replace a current module in a workbook with a updated module
of th same name. More or less like a patch. Can this be done using
code. I've looked through the threads and do not see anything that
directly relates to using code to replace the module.
M
 
B

Bob Phillips

'----------------------------------------------------------------
Function UpdateModule()
'----------------------------------------------------------------
Dim vbMod As Object

Set vbMod = ThisWorkbook.VBProject.VBComponents("mTest")
ThisWorkbook.VBProject.VBComponents.Remove vbMod

ThisWorkbook.VBProject.VBComponents.Import _
Filename:="C:\mTest.bas"

End Function


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Michael Wise" <[email protected]>
wrote in message
news:[email protected]...
 
G

Gary Keramidas

that site is helpful. i used it to create a single checkbox on a form, i use for
a menu, to toggle auto open on and of.
 
K

KR

Bob- I realize this is an old thread, but I'm catching up- I've had trouble
using code to update modules (an ongoing task) and I haven't seen this line
of code before. What does it do?
Thanks!
Keith

Bob Phillips said:
Also, include this at the start of the code module

Const vbext_pk_Proc = 0


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Michael Wise" <[email protected]>
wrote in message
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top