Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #8  
Old 05-01-2020, 11:06 AM
marceepoo marceepoo is offline Userform textbox control missing/invisible; can't find, use or replace it; how to salvage work on a Windows 7 64bit Userform textbox control missing/invisible; can't find, use or replace it; how to salvage work on a Office 2010 64bit
Novice
Userform textbox control missing/invisible; can't find, use or replace it; how to salvage work on a
 
Join Date: Sep 2012
Posts: 22
marceepoo is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
Marc

I'm not sure what you mean by 'save those values to the userform'. Just by moving the control on the userform when editing the layout you are effectively saving those values.

You can use the GUI to reposition any control on the userform (assuming you can select it). You can also use a macro such as the following to position the form itself or move a control to a particular position on the form. Because of its name, this macro will autorun when the form is loading so the form will open showing your control in its rightful position.

Code:
Private Sub UserForm_Initialize()
  With Me
    .StartUpPosition = 0
    .Left = Application.Left + 0.5 * (Application.Width - .Width)
    .Top = Application.Top + 0.5 * (Application.Height - .Height)
    .txHyperlinkzName.Top = 134
    .txHyperlinkzName.Left = 24
    .txHyperlinkzName.BackColor = &HC000&
  End With
End Sub
I use this code generically on all of my userforms (apart from your control named lines) to always position my userform in the middle of the application window. This saves lots of angst when using multiple screens.
To answer your question, Andrew, even though the encircled VBA code (on the right side of the image below) did set "txHypterlinkzName" in the location encircled in blue below on the userform, "txHypterlinkzName" would not be in that location later when I was editing the userform (i.e., dragging controls from one place to another).
In other words, after I ran the Initialize sub and subsequently closed the userform (after showing it), "txHypterlinkzName" would return to a location off the screen, which made it hard to continue editing the userform.

Graham's instructions enabled me to get to txHypterlinkzName's Properties Window (encircled in green in the attached image file, to the left).
Once I got access to txHypterlinkzName's Properties Window, I was able to manually insert the settings that are encircled in red, below to the left, inside the green box.

After I inserted those settings, I executed a Windows/Word [File, Save] on the form.
Now, when I am editing the userform, "txHypterlinkzName" continues to be situated at the location encircled in blue below.

It would be nice to know how to use vba to perform the equivalent of me manually inserting the settings in the properties window, and thereafter clicking, File, Save.

You showed me how to get and set the controls' coordinates programmatically, which was very helpful to me.

But assume that I have a large userform with many controls that need to be renamed (instead of having their coordinates changed) programmatically (which is a problem I remember having more than once), it would be nice to know how to save the changes to the form, so that the changes are embedded in the form when I resume editing the form.

Much thanks, again,

Marc
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform textbox control missing/invisible; can't find, use or replace it; how to salvage work on a Find and replace query re missing spaces Johanna Word 3 11-22-2019 01:06 AM
Userform textbox control missing/invisible; can't find, use or replace it; how to salvage work on a Macro to Find and Replace Does Not Work - But Works Manually Rod_Bowyer Excel Programming 7 10-14-2018 11:49 PM
Userform textbox control missing/invisible; can't find, use or replace it; how to salvage work on a Find and Replace doesn't work. 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

Other Forums: Access Forums

All times are GMT -7. The time now is 07:38 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft