Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-10-2018, 09:36 AM
Mbrandt5 Mbrandt5 is offline Overwriting Textbox "Property" Value Windows 7 64bit Overwriting Textbox "Property" Value Office 2013
Novice
Overwriting Textbox "Property" Value
 
Join Date: Jan 2018
Posts: 2
Mbrandt5 is on a distinguished road
Default Overwriting Textbox "Property" Value

The question is how can I use the following method to update the property Value of a textbox, and have it saved as if the userform was created in Visual Basic Editor.

While I know many people have asked this question in the past...
I have not seen answers saying how to execute it with out storing the values in a separate location.

The Saving Would Preferably Save As If The Whole Userform Was Recreated With New Default Values.

Attached is a reference value to the property "Value" that I am referring to.

If anyone knows of a simple code to overwrite Controls default values, it would be greatly appreciated. Below is a possible wrap for it.

Code:
  
Private Sub UpdateControls_Click()

    Dim CTRL As Control

    With ActiveDocument
    
            For Each CTRL In UserForm1.Controls
        
                If (TypeName(CTRL) = "TextBox" or TypeName(CTRL) = "CheckBox") Then
        
                    'OverWrite controls Userform Initialization Value with Current Value 

            Next CTRL

    End With

End Sub

Attached Images
File Type: png Property Value.png (11.1 KB, 12 views)
Reply With Quote
  #2  
Old 01-10-2018, 10:31 PM
gmayor's Avatar
gmayor gmayor is offline Overwriting Textbox "Property" Value Windows 10 Overwriting Textbox "Property" Value Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,138
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

What is the point of this exercise? Why not simply set the changed properties of the controls as you need them when you call the userform?
Code:
Sub Example()
Dim ofrm As New UserForm1
Dim oCtrl As Control
    With ofrm
        For Each oCtrl In ofrm.Controls
            If (TypeName(oCtrl) = "TextBox" Or TypeName(oCtrl) = "CheckBox") Then
                With oCtrl
                    .Font.Size = 12
                    .Font.Name = "Calibri"
                    .Width = 120
                End With
            End If
        Next oCtrl
        .Show
        Unload ofrm
    End With
    Set ofrm = Nothing
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 01-11-2018, 07:16 AM
Mbrandt5 Mbrandt5 is offline Overwriting Textbox "Property" Value Windows 7 64bit Overwriting Textbox "Property" Value Office 2013
Novice
Overwriting Textbox "Property" Value
 
Join Date: Jan 2018
Posts: 2
Mbrandt5 is on a distinguished road
Wink Why Not Not?

Why make facebook when myspace was available.

Better GUI.
Less Storage Requirements.
Less Electricity.
Less Data Usage /\.
More Free Time.

Just to name a few.

Your code is much different than what I inquired about.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Overwriting Textbox "Property" Value "Linking" an arrow to textbox mferrigno Drawing and Graphics 1 02-04-2016 03:11 PM
Where can the Document Property "Company Address" be manually edited? JS411 Word 8 12-17-2015 10:26 PM
Word 2013 "Document Property" Rude Awakening Word 2 10-28-2015 08:07 AM
help with compatibility of "WdSaveFormat" property of SaveAs method ajetrumpet Word 0 07-15-2013 07:29 AM
Want to search for "class", replacing with document property YetAnotherAuthor Word 0 10-30-2009 09:43 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:14 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