View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
[email protected] halimnurikhwan@yahoo.com is offline
external usenet poster
 
Posts: 113
Default Is This Possible?

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