LeoLisogorsky
Automotive
- Apr 21, 2005
- 1
I have to import a "base" UserForm, add some controls and code and then show the form.
Using the code included below, the problem I have is that when VBA executes VBA.UserForms.Add(NewTempForm.Name).Show, the report goes back to the base (as imported).
To verify what instruction was deleting my changes I generated a run-time error in different parts of the code and checked the UserForm Manually.
1) Is there any way to execute this code Step by Step?
(Now I get the error "Can't enter break mode at this time")
2) Is there other way to show the form without loosing my changes?
Thanks,
Leo.
The code I am using is:
'Import Base Form
Set NewTempForm = ThisWorkbook.VBProject.VBComponents.Import(ThisWorkbook.Path & "\" & FORM_NAME)
'Set Properties
With NewTempForm
.Properties("Caption") = NewTempForm.Name
.Properties("Height").Value = .Properties("Height").Value + No * DELTA_H
End With
'Add Event Code Here
'Code removed for simplicity
'
'End of Code
'Show Form
VBA.UserForms.Add(NewTempForm.Name).Show
'Remove Form
ThisWorkbook.VBProject.VBComponents.Remove (NewTempForm)
Using the code included below, the problem I have is that when VBA executes VBA.UserForms.Add(NewTempForm.Name).Show, the report goes back to the base (as imported).
To verify what instruction was deleting my changes I generated a run-time error in different parts of the code and checked the UserForm Manually.
1) Is there any way to execute this code Step by Step?
(Now I get the error "Can't enter break mode at this time")
2) Is there other way to show the form without loosing my changes?
Thanks,
Leo.
The code I am using is:
'Import Base Form
Set NewTempForm = ThisWorkbook.VBProject.VBComponents.Import(ThisWorkbook.Path & "\" & FORM_NAME)
'Set Properties
With NewTempForm
.Properties("Caption") = NewTempForm.Name
.Properties("Height").Value = .Properties("Height").Value + No * DELTA_H
End With
'Add Event Code Here
'Code removed for simplicity
'
'End of Code
'Show Form
VBA.UserForms.Add(NewTempForm.Name).Show
'Remove Form
ThisWorkbook.VBProject.VBComponents.Remove (NewTempForm)