Saving Workbook without Userforms

chiquitaN1
03-10-2003, 09:13 AM
My application deals with estimating Job costing, it takes all values given by the user and copies them to the workbook/worksheet, the app. works as a template. Does anyone have any idea how to save only the workbook with the copied values(i do know how to SAVEAS the workbook)NOT the userforms. Obviously the app. is very large because of these forms so they are not required. If the user needs to modify the calculations he should be able to open the worksheet without the userforms .showing or loading since some formulas are left on the worksheet itself if the user should add anymore data. Excel does not allow you to import or export these forms. A .Remove does not exist in VB so any suggestions on how to attempt this.

hoping for a response soon
thank you

Insomniac
03-10-2003, 10:06 AM
1st might I suggest that you store the forms in an addin that is loaded by the workbook as needed.

2nd you can import/export forms & modules by accessing the VBE directly eg:

Sub ImportCode()
With Application
.VBE.ActiveVBProject.VBComponents.Import ThisWorkbook.Path & "\MyModule.bas"
.VBE.ActiveVBProject.VBComponents.Import ThisWorkbook.Path
& "\MyForm.frm"
End With
End Sub

the opposite to export before save.

Note the VBProject must be unprotected for this to work.

chiquitaN1
03-10-2003, 10:52 AM
1st might I suggest that you store the forms in an addin that is loaded by the workbook as needed.

2nd you can import/export forms & modules by accessing the VBE directly eg:

Sub ImportCode()
With Application
.VBE.ActiveVBProject.VBComponents.Import ThisWorkbook.Path & "\MyModule.bas"
.VBE.ActiveVBProject.VBComponents.Import ThisWorkbook.Path
& "\MyForm.frm"
End With
End Sub

the opposite to export before save.

Note the VBProject must be unprotected for this to work.

Hey Thanks!
I'll give it try.

chiquitaN1
03-10-2003, 11:11 AM
Hey Thanks!
I'll give it try.


I forgot to much i've not used VB add-ins yet, i read on it though, does this mean i have to save my vba project as an add-in, i'm working within the excel environment not VB.

thanks

Insomniac
03-10-2003, 12:00 PM
I forgot to much i've not used VB add-ins yet, i read on it though, does this mean i have to save my vba project as an add-in, i'm working within the excel environment not VB.

thanks

Design your form and save as Excel addin (xla) in the same directory as the workbook concerned.
-Include a macro in a module to show the form
eg
sub ShowMyForm()
userform1.show
end sub

in the workbook open event of relevant Excel file (.xls)

Private Sub Workbook_Open()
Workbooks.Open ThisWorkbook.Path & "\MyAddin.xla"
Application.Run "'MyAddin.xla'!ShowMyForm"
End Sub

you sound as though you are clever enough to work it out!!!

adjust to suit.

chiquitaN1
03-17-2003, 02:09 PM
Thanks!!!

guess i'm not so dumb, i was able to figure it out. Now get some sleep you.

take care

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum