Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm still having a couple small problems...
1. It's not letting me remove a form and then import the new form right away. It will remove the form but then give the error that the name exists and can't import the new form. But, it will import the form the next time through the Sub. (I'm using On Error Resume Next in case the form never existed in the first place.) 2. Doing the same thing for a module it removes the module just fine but on the import it adds a 1 to the module name, ex. "updater1" when it should be just "updater" Here's some of the code that I use: Sub checkUpdates() ... 'If there's a newer version then... 'base has been set as Activeworkbook Dim VBComp As Object Set VBComp = base.VBProject.VBComponents("updater") base.VBProject.VBComponents.Remove VBComp base.VBProject.VBComponents.Import "K:\C-REPORT\VersionUpdate\updater.bas" 'this sub is contained inside updater runUpdates End Sub Sub runUpdates() On Error Resume Next 'up has been set to a workbook that tells what to remove, 'and the path of the file to be imported Do While up.Sheets("Start").Cells(row, 1) < "" Set VBComp = base.VBProject.VBComponents(up.Sheets("Start").Cel ls(row, 2)) base.VBProject.VBComponents.Remove VBComp base.VBProject.VBComponents.Import up.Sheets("Start").Cells(row, 3) row = row + 1 Loop End Sub I hope some of this makes sense. Thanks for any help. "Chip Pearson" wrote: Try something like the following: With ActiveWorkbook.VBProject.VBComponents .Remove .Item("UserForm1") .Import Filename:="C:\whatever\userform1.frm" End With See www.cpearson.com/excel/vbe.htm for more details. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Removing check boxes (forms toolbar) | Excel Worksheet Functions | |||
Importing Alan Beban's code on Arrays; Importing a module or a project | Excel Worksheet Functions | |||
Importing multiple forms into a single Excel list | Excel Discussion (Misc queries) | |||
how to add numbers from different areas in chart and importing forms from word | New Users to Excel | |||
Removing a user form with code | Excel Programming |