Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2005

Tip: Looking for answers? Try searching our database.

Black and Gray

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rob p - 15 Mar 2005 23:24 GMT
I needed to suppress (I changed to gray instead) text in cells in checkbox
not checked along with the three cells next to it. Bold text if checked.
Astrid helped me out with code. I needed to change the cells next to the
checkbox too.
Here is what I have. (Toggleprotectdocument turns on / off lock). On a
simple table this macro works.

On a more complicated table with many varying sized cells, the first
checkbox seems to work. Going to the next checkbox, I then get an error 4120
bad parameter on the line with stars.

How can I tighten up the code / and further debug. Showing me that line
isn't helping. I can't see what is wrong. I seem to get the error with the
box checked or not. Also macro runs on exit.
Thanks.

Sub togglemulticells()
Let col = 0
Let Row = 0
col = Selection.Cells(1).ColumnIndex                       ' find cell I am
in and 3 over for range
Row = Selection.Cells(1).RowIndex                         ' find row
 Set myTable = ActiveDocument.Tables(1)
   Set myrange = ActiveDocument.Range(myTable.Cell(Row, col) _
   .Range.Start, myTable.Cell(Row, col + 3).Range.End)
 ToggleProtectDocument
MsgBox Row
MsgBox col
***  If ActiveDocument.FormFields(FormfieldName()).CheckBox.Value = True
Then ***
  myrange.Font.Color = wdColorBlack ' works
 Else
 myrange.Font.Color = wdColorGray50 ' works
 End If
 ToggleProtectDocument
End Sub
Word Heretic - 18 Mar 2005 13:35 GMT
G'day "rob p" <nospam*wlb@stans.net>,

FormfieldName() seems nonsensical, what is it standing for?

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice

rob p reckoned:

>FormfieldName()
Rob Peterson - 18 Mar 2005 17:50 GMT
Hi. It's a sub that is supposted to find field name. I got from another
example. It is as follows:

Function FormfieldName() As Variant

 If Selection.FormFields.Count = 1 Then
   FormfieldName = Selection.FormFields(1).Name
 ElseIf Selection.FormFields.Count = 0 And Selection.Bookmarks.Count > 0
Then
   FormfieldName = Selection.Bookmarks(Selection.Bookmarks.Count).Name
 End If

End Function

> G'day "rob p" <nospam*wlb@stans.net>,
>
[quoted text clipped - 8 lines]
>
> >FormfieldName()
David Sisson - 18 Mar 2005 21:21 GMT
Try Form­fieldName instead of Form­fieldName()

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.