ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing object properties permanently at runtime (https://www.excelbanter.com/excel-programming/373102-changing-object-properties-permanently-runtime.html)

Darv

Changing object properties permanently at runtime
 
Hi,

I'm having trouble changing the properties of objects permanently at
runtime. Specifically, I am trying to make a commandbutton visible at
runtime. This works fine, but when I reset the VBA code, the
commandbutton returns to it's state prior to running the code.

Thanks for any help anyone can give.

David


NickHK

Changing object properties permanently at runtime
 
David,
Yes, that is the difference in meaning between "Design Time" and "Run Time".
If you want a property to be set for the next time you open that workbook,
you need to change it the Design time.

NickHK

"Darv" wrote in message
oups.com...
Hi,

I'm having trouble changing the properties of objects permanently at
runtime. Specifically, I am trying to make a commandbutton visible at
runtime. This works fine, but when I reset the VBA code, the
commandbutton returns to it's state prior to running the code.

Thanks for any help anyone can give.

David




Darv

Changing object properties permanently at runtime
 
Hi Nick,

I understand that, but is it possible to change a design time property
at runtime?

David


Peter T

Changing object properties permanently at runtime
 
Hi David,

Sub Test()
Dim dForm As UserForm

Set dForm = ThisWorkbook.VBProject.VBComponents("Userform1").D esigner
dForm.CommandButton2.Caption = Time

End Sub

You can't do this while Userform1 is loaded (AFAIK). Can also add/delete
controls.

(You'll need trust access to vb projects in xl2002+)

Regards,
Peter T

"Darv" wrote in message
ups.com...
Hi Nick,

I understand that, but is it possible to change a design time property
at runtime?

David




Darv

Changing object properties permanently at runtime
 
Perfect thanks!


Peter T wrote:

Hi David,

Sub Test()
Dim dForm As UserForm

Set dForm = ThisWorkbook.VBProject.VBComponents("Userform1").D esigner
dForm.CommandButton2.Caption = Time

End Sub

You can't do this while Userform1 is loaded (AFAIK). Can also add/delete
controls.

(You'll need trust access to vb projects in xl2002+)

Regards,
Peter T

"Darv" wrote in message
ups.com...
Hi Nick,

I understand that, but is it possible to change a design time property
at runtime?

David




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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com