LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default About Naming MSForm in VBE.


The following code could only run correctly once after the workbook's
open. I could not understand why we couldn't name a form as the early
one we've deleted before. IF we change vbext_ct_MSForm to
vbext_ct_StdModule, all goes well.
What's the reason of it? Is it caused by form's designer object?
Thanks in advance.
Sub AddAndRenameVBComponent()
Dim oProjForm As VBComponent
Dim oProj As VBProject

Const sFormName As String = "FormTest"

Set oProj = ThisWorkbook.VBProject

On Error Resume Next
oProj.VBComponents.Remove oProj.VBComponents(sFormName)
On Error GoTo 0

Set oProjForm = oProj.VBComponents.Add(vbext_ct_MSForm)

With oProjForm
.Name = "Test"
End With

End Sub
 
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
Tab Naming michelle Excel Worksheet Functions 0 October 12th 06 10:19 PM
Saving MSForm.Control (s) created at Runtime? Post Tenebras Lux Excel Programming 1 August 16th 06 07:31 AM
Creating an MSForm based on a table Quentin[_3_] Excel Programming 0 June 9th 06 07:48 PM
MSForm 1 - Initial placement of form Tim Coddington Excel Programming 2 October 1st 04 03:05 PM
MSForm 2 - Creating labels and text boxes at run time Tim Coddington Excel Programming 2 October 1st 04 03:03 PM


All times are GMT +1. The time now is 12:30 PM.

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

About Us

"It's about Microsoft Excel"