-
-
Thanks for looking but I think I have it figured out. I'm marking this solved. Hope I didn't waste anyones time.
Thanks,
Tracy
-
If you figured it out, please post what you figured out.
I can tell you right now that:[vba]ActiveDocument.Tables.Rows.Count[/vba]will fail as there is no index for the table. You need something like:[vba]ActiveDocument.Tables(2).Rows.Count[/vba]for example. This action the second table. Or:[vba]Selection.Tables(1).Rows.Count[/vba]which actions the table the Selection is in.
In any case, tell what you did do. Thanks.
-
Sorry it took so long to get back to this post
Here is the code I came up with.
[vba]Sub CustomDeleteRow()
Dim myCheck As VbMsgBoxResult
ActiveDocument.Unprotect Password:="password"
If Selection.Cells(1).RowIndex <= 8 Then
MsgBox ("You cannot delete this row."), vbOKOnly
Else
myCheck = MsgBox("Are you sure you want to delete this row?", vbYesNo)
If myCheck = vbYes Then
Selection.Rows(1).Delete
Else
Exit Sub
End If
End If
ActiveDocument.Protect wdAllowOnlyFormFields, Password:="password"
End Sub
[/vba]
Maybe it could be done better but this is working for me.
Thanks,
Tracy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules