Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default adding components in VBA

Hi, is there a way that i can add text boxs and labels to my userfor
using coding instead of just using the toolbox?

Can this be done? thanks chris

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default adding components in VBA

Chris,

Yes, it can be done. The changes are temporary, though; the
control will disappear when the form is unloaded. For example,
the following will add a text box to Userform1.

Dim TBX As MSForms.TextBox
With UserForm1.Controls
Set TBX = .Add(bstrprogid:="Forms.TextBox.1", _
Name:="MyTextBox", Visible:=True)
TBX.Top = 50
TBX.Left = 100
End With
UserForm1.Show


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"chrisdarl " wrote in
message ...
Hi, is there a way that i can add text boxs and labels to my

userform
using coding instead of just using the toolbox?

Can this be done? thanks chris.


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default adding components in VBA

Alternative approach is to add them at design time, but hide them until you
need them.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"chrisdarl " wrote in message
...
Hi, is there a way that i can add text boxs and labels to my userform
using coding instead of just using the toolbox?

Can this be done? thanks chris.


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default adding components in VBA

Here is another source of information:

http://j-walk.com/ss/excel/tips/tip76.htm
Creating a UserForm Programmatically

or the parent page:
http://j-walk.com/ss/excel/tips/userformtips.htm

at John Walkenbach's site

--
Regards,
Tom Ogilvy


"chrisdarl " wrote in message
...
Hi, is there a way that i can add text boxs and labels to my userform
using coding instead of just using the toolbox?

Can this be done? thanks chris.


---
Message posted from http://www.ExcelForum.com/



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
MS Web Components yaanai Excel Discussion (Misc queries) 0 February 7th 08 04:42 AM
office web components joia Excel Worksheet Functions 2 August 11th 05 12:37 PM
Taking data from 3 different cells and adding the components toget Dubbs Excel Worksheet Functions 3 June 9th 05 05:23 PM
Using Microsoft Web Components In VB sharon Excel Programming 1 December 15th 03 02:20 PM
Adding components to multipage programatically Nigel Brown[_2_] Excel Programming 0 August 4th 03 10:25 AM


All times are GMT +1. The time now is 01:28 AM.

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"