Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Dec 2, 11:09 am, "Chip Pearson" wrote:
It has been a long time since I really looked at that page, but it appears that I intended that CopyModule be used only on standard code modules (Type = vbext_ct_StdModule) or class modules (Type = vbext_ct_ClassModule), not Document modules or UserForms. This limitation didn't make it on the the web page. I'll revise the code on the page to support other types of modules. Actually, it seems that UserForms work well with the existing code, because they are programmatically removeable. Here's a simple example, where there is an existing UserForm1 object in a project: Sub foo() Dim proj As VBIDE.VBProject Dim comp As VBIDE.VBComponent Set proj = ThisWorkbook.VBProject Set comp = proj.VBComponents("UserForm1") With comp exportedName = Environ("Temp") & "\" & .Name & ".frm" .Export exportedName End With With proj.VBComponents .Remove comp .Import exportedName End With Kill exportedName Kill Left(exportedName, Len(exportedName) - 4) & ".frx" End Sub This code runs without any glitches, and cleanly exports, removes, and re-imports the user form object. Note that you have to also take care of the FRX blob file at the end. In other news, I adopted the approach of pre-processing the Sheet file to remove the metadata, with flawless success. I suppose that to make it more generic, I should expect a "Version" line, followed by a "BEGIN" line, then some stuff, then finally a "END" line. After that point, the rest of the text should be written to another file and added in. Cheers, -Basilisk96 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Question on a Chip Pearson macro | Excel Programming | |||
Question to Chip Pearson | Excel Programming | |||
Chip Pearson: A Question about RegServ32 and DLLs :) | Excel Programming | |||
CHIP PEARSON - THANX | Excel Programming | |||
Chip Pearson or someone | Excel Programming |