![]() |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
![]()
I made a userform named, “frmTOE_ExhMakeFromData01” which contains a textbox control named, “txHyperlinkzName”
The textbox control disappeared. I assumed that I must have inadvertently deleted it during the weeks I’ve been working on the userform, and I tried to recreate the textbox, “txHyperlinkzName” But when I tried to assign the named “txHyperlinkzName” to the new textbox control, a message from Windows VBA said: Could not set the Name property. Ambiguous name. Hoping to make the textbox control prominent in the userform so that I could find it among the many controls on the userform, I ran a sub which assigned a vibrant color to the control’s background property, and I assigned text to the textbox’s text property. To no avail; the textbox still was not visible. I ran the following sub to get a list of all of the controls in the userform: Code:
Sub subUserformControls_Output2TxFile(sFormName As UserForm) 'https://stackoverflow.com/questions/25248034/how-do-i-list-print-control-names-and-or-properties-on-a-vba-form Dim ctlLoop As MSForms.Control Dim sMsgboxMsg As String Dim sDateTime As String sDateTime = CStr(Format(Now(), "yyyy-mm-dd_hh-mm-ss")) sMsgboxMsg = sDateTime For Each ctlLoop In sFormName.Controls sMsgboxMsg = sMsgboxMsg & vbCrLf & _ CStr(TypeName(ctlLoop)) & ":" & CStr(ctlLoop.Name) Next ctlLoop Call subWrite2TxtFileAndOpenInEditPadPro(sMsgboxMsg) End Sub ' subUserformControls_Output2TxFile(sFormName) Run-time error '91': Object variable or With block variable not set That sub or some other version (of that sub) which I inadvertently deleted, produced an output listing all of the controls in the form, and the list did indeed include a textbox control named, “txHyperlinkzName” Questions: A. What did I do to cripple the sub above? B. What do I do now? 1. Should I just create a new textbox control and put it where the missing one was, and continue working on the form? or ... 2. Should I presume that the file is corrupt and that continuing to work on its development is a waste of time? In other words, should I start over on my userform from scratch? or ... 3. I created my userform in the VBA IDE, dragging textboxes, labels, cmd buttons, etc. onto a canvas. But I think people with more knowledge than I have, create userforms entirely by VBA. In other words, are there VBA techniques I could use to: a. Extract from my userform all the properties of each control (frames, textboxes, labels, cmd btns, option btns, etc.) including the location information (i.e., where they were situated in the userform, and the size (length and width) of the control)? b. Use the extracted info to re-create the userform? Thank you for any advice. Marc |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Johanna | Word | 3 | 11-22-2019 01:06 AM |
![]() |
Rod_Bowyer | Excel Programming | 7 | 10-14-2018 11:49 PM |
![]() |
Bop70 | Word | 3 | 02-04-2015 11:45 AM |
Userform is invisible in Project box for old templates | billy8b8 | Word VBA | 4 | 07-19-2014 03:44 PM |
Find and replace No longer work | TJH | Word | 3 | 03-25-2014 11:33 PM |