klm1780
02-27-2015, 11:24 AM
I have a very old Word document that has a broken macro that I am trying to fix but I have limited VBA knowledge.
Currently there are Legacy Forms checkmark boxes used in the following macro:
Sub UpdateBookmark(BookmarkToUpdate As String, TextToUse As String)
Dim BMRange As Range
Set BMRange = ActiveDocument.Bookmarks(BookmarkToUpdate).Range
BMRange.Text = TextToUse
ActiveDocument.Bookmarks.Add BookmarkToUpdate, BMRange
End Sub
Private Sub showBookmarks()
Dim d As Document
Set d = Documents.Add("C:\Users\Owner-PC\Desktop\Test1.docm")
'Dim b As Bookmark
'Set b = d.Bookmarks(
'Deck Preparation
If (ActiveDocument.FormFields("deckscope2c").CheckBox.Value = False) Then
ActiveDocument.Bookmarks("deckscope2").Range.Delete
End If
The problem is that I can't check those checkmark boxes without the properties box coming up and I also can't tab through the boxes so I would like to change them to Command (Content) Control checkmark boxes which I can tab to and check off. Unfortunately when I tried to change the macro to read:
If (ActiveDocument.CommandControls("deckscope2c").CheckBox.Value = False) Then
ActiveDocument.Bookmarks("deckscope2").Range.Delete
End If
It gives me a runtime error 438: Object doesn't support this property or method.
Any suggestions would be appreciated :)
Currently there are Legacy Forms checkmark boxes used in the following macro:
Sub UpdateBookmark(BookmarkToUpdate As String, TextToUse As String)
Dim BMRange As Range
Set BMRange = ActiveDocument.Bookmarks(BookmarkToUpdate).Range
BMRange.Text = TextToUse
ActiveDocument.Bookmarks.Add BookmarkToUpdate, BMRange
End Sub
Private Sub showBookmarks()
Dim d As Document
Set d = Documents.Add("C:\Users\Owner-PC\Desktop\Test1.docm")
'Dim b As Bookmark
'Set b = d.Bookmarks(
'Deck Preparation
If (ActiveDocument.FormFields("deckscope2c").CheckBox.Value = False) Then
ActiveDocument.Bookmarks("deckscope2").Range.Delete
End If
The problem is that I can't check those checkmark boxes without the properties box coming up and I also can't tab through the boxes so I would like to change them to Command (Content) Control checkmark boxes which I can tab to and check off. Unfortunately when I tried to change the macro to read:
If (ActiveDocument.CommandControls("deckscope2c").CheckBox.Value = False) Then
ActiveDocument.Bookmarks("deckscope2").Range.Delete
End If
It gives me a runtime error 438: Object doesn't support this property or method.
Any suggestions would be appreciated :)