View Single Post
 
Old 10-06-2021, 08:35 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

OK, firstly get rid of the legacy form field you were using for the Tipo de Incremento and instead put a Dropdown List Content Control in its place, set its Title property to TIncremento and add the four options.

Then add this code to your ThisDocument module
Code:
Private Sub Document_ContentControlOnExit(ByVal aCC As ContentControl, Cancel As Boolean)
  Dim i As Long, bOne As Boolean
  With aCC
    If .Title = "TIncremento" Then
      Select Case LCase(.Range.Text)
        Case "disco", "filesystem"
          bOne = True
        Case "memoria", "cpu/slices"
          bOne = False
      End Select
      LockCC ActiveDocument.SelectContentControlsByTitle("lunidad")(1), Not bOne
      LockCC ActiveDocument.SelectContentControlsByTitle("espacio")(1), Not bOne
      LockCC ActiveDocument.SelectContentControlsByTitle("memoria")(1), bOne
    End If
  End With
End Sub

Function LockCC(aCC As ContentControl, bLock As Boolean)
  With aCC
    aCC.LockContents = False
    If bLock Then
      aCC.Range.Text = ""
      .Color = wdColorGray50
    Else
      .Color = wdColorYellow
    End If
    aCC.LockContents = bLock
  End With
End Function
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote