Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Norman,
I tried this but I get a "Run-time error '1004': Programmatic access to Visual Basic Project is not trusted". Do you know why? The code is in a pw protected project, but the form I exported to a temp folder and the new workbook where i am copying the form to is not. -- Trefor "Norman Jones" wrote: Hi Mike, Try something like: '============= Public Sub Tester() Dim srcWB As Workbook Dim destWb As Workbook Const sStr As String = "C:\myFile.frm" Set srcWB = Workbooks("MyBook1.xls") Set destWb = Workbooks("MyBook2.xls") srcWB.VBProject.VBComponents("Userform1").Export _ Filename:=sStr destWb.VBProject.VBComponents.Import _ Filename:=sStr Kill sStr End Sub '<<============= For more informatoion on exporting / importing modules, see Chip Pearson at: Programming To The Visual Basic Editor http://www.cpearson.com/excel/vbe.htm --- Regards, Norman "MikeZz" wrote in message ... Title says it all... I'm using VBA to set up a new workbook. I want the new workbook to have stand alone macros and user forms. I can create the user forms and macros within the workbook that I'm copying from. I just want to duplicate those into the new workbook. Thanks! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy or Print from User Form? | Excel Programming | |||
USER FORM COPY | Excel Programming | |||
Copying template to workbook but user form does not copy? | Excel Programming | |||
copy sheets selected on user form | Excel Programming | |||
Copy from User form to Sheet macro | Excel Programming |