Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Exporting VB Forms Automatically

I am trying to export several Forms that I have created using VBEditor. I am
not aware if this is possible or the correct syntax to export the form to a
text file and then upload the form to another worksheet automatically. I
have approximately 40+ spreadsheets that need to have the same form in each
file. I have done this successfully with Modules but not with Forms. Is it
possible to export and import automatically? Here is a sample of the syntax
that I used for the modules......

With Workbooks(RollUpProg)
FName = .Path & "\code.txt"
.VBProject.VBComponents("InventoryWalk2").Export FName
End With
Workbooks(datafilename).VBProject.VBComponents.Imp ort FName
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Exporting VB Forms Automatically


Hello aVBgrad,

The syntax is almost identical to importing or exporting a module. Just
change UserForm1 to the form name you are using. The file name must end
in .frm

'This code must be run from the Workbook the Forms are in to be
exported.
With Workbooks(RollUpProg)
FName = .Path & "\Test Form.frm"
..VBProject.VBComponents("UserForm1").Export FName
End With

'This code must be run from the Workbook that it is in to import the
form.
Workbooks(datafilename).VBProject.VBComponents.Imp ort FName

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=493228

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Exporting VB Forms Automatically

Thanks....that did the trick. But do you know how to remove or delete a from.
I can do this with a module but am having issues with a Form. Here is the
syntaxt I use for a module

Set VBComp = Workbooks(RollUpProg).VBProject.VBComponents("User Form1")
ActiveWorkbook.VBProject.VBComponents.Remove VBComp


Leith Ross wrote:
Hello aVBgrad,

The syntax is almost identical to importing or exporting a module. Just
change UserForm1 to the form name you are using. The file name must end
in .frm

'This code must be run from the Workbook the Forms are in to be
exported.
With Workbooks(RollUpProg)
FName = .Path & "\Test Form.frm"
.VBProject.VBComponents("UserForm1").Export FName
End With

'This code must be run from the Workbook that it is in to import the
form.
Workbooks(datafilename).VBProject.VBComponents.Im p ort FName

Sincerely,
Leith Ross


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200512/1
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatically populate forms excel_expert_wannabe Excel Worksheet Functions 1 June 10th 08 11:16 AM
Automatically exporting data to a second sheet [email protected] Excel Discussion (Misc queries) 1 July 20th 06 01:53 PM
Automatically resize excel charts when exporting them to PowerPoin mustang25 Charts and Charting in Excel 2 May 20th 06 07:10 AM
Print out certain forms automatically Lost! Excel Discussion (Misc queries) 0 June 4th 05 08:49 PM
Exporting the chart automatically Robert Hargreaves Charts and Charting in Excel 0 May 27th 05 05:28 PM


All times are GMT +1. The time now is 04:01 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"