View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Jason Zischke Jason Zischke is offline
external usenet poster
 
Posts: 147
Default Is This Possible?

Hi Halim

Thanks for the responce what I meant was that when for example the user was
finished with the userform that it would remove it form the VBProject and
also when I go to save my workbook that this code is in norton anti-virus
brings up an alert the there is a virus and will not let the workbook save
but when i did a check for viruses on my computer but it didn't find it so it
must be something to do with code.

Jason

" wrote:

hi Jason,
1. To Export module1 :
From :

Sub TestExportForm()
ThisWorkbook.VBProject. _
VBComponents("Userform1").Export "C:\Userform1.frm"
End Sub

Change to:
Sub TestExportForm()
ThisWorkbook.VBProject. _
VBComponents("Module1").Export "C:\Userform1.frm"
End Sub

Assume that Vb components name is all vb: module, userform, class
module
in a project of VB.
Just change VBComponents item or name or index you can choose by your
self!.


2. About virus caution, check you macro security first before running
it!
setup your macro security to low mode.

If you want to remove module1 after export, try this :
Sub TestRemoveModule1()
ThisWorkbook.VBProject.VBComponents.Remove _
ThisWorkbook.VBProject.VBComponents("Module1")
End Sub


Regards,

Halim



Jason Zischke menuliskan:
Hi Halim,

I tried the code below however when I go to save it says that there is a
virus that seem to be caused by the code and wont allow me to save. Any help
with this would be greatly appreicated.

Jason

" wrote:

Hi Jason,
Sure it is possible that we can store the Vb Components like UserForm,
Class Module,
Module.
Try this :
Sub TestExportForm()
ThisWorkbook.VBProject. _
VBComponents("Userform1").Export "C:\Userform1.frm"
End Sub

Sub TestImportForm()
ThisWorkbook.VBProject.VBComponents.Import "C:\Userform1.frm"
End Sub

Regards,

Halim

Jason Zischke menuliskan:
Hi all

I was plugged with this question and I need to know whether it is possibly.
Can you Export out Userforms, Modules & Class Moudules then call them back
into excel rather then having a large excel file with all of them stored in
there?

Thanks in advance

Jason