#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default Designer

Hi all,

Can anyone tell me, how I can change the caption of an EXISTING label in a
userform, in runtime, using the Designer object, so that the caption is saved
even after the userform is unloaded?
--
A. Ch. Eirinberg
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Designer

Try something like

With ThisWorkbook.VBProject.VBComponents("UserForm1").D esigner
.Controls("Label1").Caption = "new text"
End With

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Wed, 11 Mar 2009 13:36:01 -0700, Howard31
wrote:

Hi all,

Can anyone tell me, how I can change the caption of an EXISTING label in a
userform, in runtime, using the Designer object, so that the caption is saved
even after the userform is unloaded?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default Designer

Thanks ever so much Chip, for responding.

I have tried just this, the problem is that I get a runtie error message -
"Object variable or With block variable not set"

This is the code copied and pasted from the VBE:

With ThisWorkbook.VBProject.VBComponents("UFPwd").Desig ner
.Controls("LblPwd").Caption = "NewPassword"
End With

As I'm already writing to you, can I ask whether it is possible to customize
the Ribbon in Excel 2007 via VBA?


--
A. Ch. Eirinberg


"Chip Pearson" wrote:

Try something like

With ThisWorkbook.VBProject.VBComponents("UserForm1").D esigner
.Controls("Label1").Caption = "new text"
End With

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Wed, 11 Mar 2009 13:36:01 -0700, Howard31
wrote:

Hi all,

Can anyone tell me, how I can change the caption of an EXISTING label in a
userform, in runtime, using the Designer object, so that the caption is saved
even after the userform is unloaded?


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Designer

The code looks good to me. You might try breaking down the objects to
see what is actually causing the error. Set a Reference to "Microsoft
Visual Basic For Applications Extensibility Library 5.3" and then use
code like

Sub AAA()
Dim VBProj As VBIDE.VBProject
Dim VBComp As VBIDE.VBComponent
Dim Des As msforms.UserForm
Dim Ctrl As msforms.Label

Set VBProj = ThisWorkbook.VBProject
Set VBComp = VBProj.VBComponents("UserForm1")
Set Des = VBComp.Designer
Set Ctrl = Des.Controls("Label1")
Ctrl.Caption = "The new text string"
End Sub

This will break on the line that has the error.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Wed, 11 Mar 2009 15:06:03 -0700, Howard31
wrote:

Thanks ever so much Chip, for responding.

I have tried just this, the problem is that I get a runtie error message -
"Object variable or With block variable not set"

This is the code copied and pasted from the VBE:

With ThisWorkbook.VBProject.VBComponents("UFPwd").Desig ner
.Controls("LblPwd").Caption = "NewPassword"
End With

As I'm already writing to you, can I ask whether it is possible to customize
the Ribbon in Excel 2007 via VBA?

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
Excel rejects XSD from Visual Studio DataSet Designer rico Excel Discussion (Misc queries) 0 September 16th 08 09:35 PM
Set UserForm's HelpContextID with Designer RB Smissaert Excel Programming 0 January 18th 06 08:37 PM
Designer dummy in Excel - Need (nested?) If statement... Excel Dummy Excel Discussion (Misc queries) 1 December 30th 05 06:37 PM
how do i insert a code bar or link to a adobe designer file Luis Arechiga Excel Worksheet Functions 1 December 19th 05 02:10 AM
how fill adatabasein domino designer with information of excel zoy Excel Worksheet Functions 0 May 6th 05 09:29 PM


All times are GMT +1. The time now is 10:23 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"