LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Update Sheet code using VBA - question for Chip Pearson

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question on a Chip Pearson macro [email protected] Excel Programming 4 January 26th 06 12:07 AM
Question to Chip Pearson Doug[_9_] Excel Programming 2 January 19th 04 03:56 PM
Chip Pearson: A Question about RegServ32 and DLLs :) Mike-hime Excel Programming 2 January 6th 04 06:26 PM
CHIP PEARSON - THANX bertieBassett Excel Programming 0 November 3rd 03 02:01 PM
Chip Pearson or someone Chip Pearson Excel Programming 3 September 18th 03 05:22 AM


All times are GMT +1. The time now is 03:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"