zelarra821
Registered User.
- Local time
- Today, 05:58
- Joined
- Jan 14, 2019
- Messages
- 847
Hi. I would like to know if it is possible to copy, through VBA, the background color of a button, to hover color.
I explain why. When I import a database, I change the color that I have customized for the buttons. This, from what I have been able to appreciate, is because I change the Use theme property, from Yes to No. I have found a code that changes that property to Yes in all the buttons of the forms. That's why I ask you if, in this code, you could add so that you copy the value of the property of the bottom of the button, to the property of the hover.
I leave the code, in case someone serves for something:
Thank you.
I explain why. When I import a database, I change the color that I have customized for the buttons. This, from what I have been able to appreciate, is because I change the Use theme property, from Yes to No. I have found a code that changes that property to Yes in all the buttons of the forms. That's why I ask you if, in this code, you could add so that you copy the value of the property of the bottom of the button, to the property of the hover.
I leave the code, in case someone serves for something:
Code:
Private Sub UsarTema_Click()
Dim strForm As String, db As DAO.Database
Dim doc As DAO.Document
Dim F As Object
Set db = CurrentDb
For Each doc In db.Containers("Forms").Documents
strForm = doc.Name
DoCmd.OpenForm strForm, acDesign
Set F = Access.Forms(doc.Name)
Dim ctl As Control
For Each ctl In F
If ctl.ControlType = acCommandButton Then
If ctl.UseTheme = False Then
ctl.UseTheme = True
End If
End If
Next ctl
Set ctl = Nothing
DoCmd.Close acForm, strForm, acSaveYes
Next doc
Set doc = Nothing
Set db = Nothing
End Sub
Thank you.