If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#11
|
|||
|
|||
Auto number a column in table using SEQ
Kaz
{macrobutton scratchmacro {docvariable myvar}} Is a DocVariable field, nested in a macrobutton field. The { } pairs are entered with CTRL+F9. When the field results are displayed are you will see is the count or the number. If you doubleclick that number, you will fire the macro to recalculate. See: http://gregmaxey.mvps.org/Word_Fields.htm for more on Word fields. -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. kaz wrote: Hi Greg I'm getting there (slowly). So, my macro is now giving me the result I want and I can get the result displayed in the required place in the document. But I have achieved this by manually running the macro then updating the field using F9. I am guessing that the command "{ Macrobutton Scratchmacro {DocVariable myVar}} " that you supplied is supposed to run the macro as well as displaying the variable but I can't get that to work. I'm (obviously) new to all of this so it is probably the way I am creating / recording the macro or the actual syntax. Can you please just help me one more time? Cheers Kaz |
#12
|
|||
|
|||
Auto number a column in table using SEQ
Okey dokey. Got that bit working. But, is there some other way of
executing the macro? I will be providing the document to users to fill in. I am not sure about getting them to double-click to run the macro. Other templates we have created require the user to Select All and then Press F9. Is there an alternative method for running the macro? |
#13
|
|||
|
|||
Auto number a column in table using SEQ
Kaz,
You could add a prompt: { Macrobutton Scratchmacro "Double click to count items: { Docvariable myVar }" } AFAIK other than that, you would have to assign the macro to a keyboard shortcut, menu, or toolbar icon. -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. "Greg Maxey" wrote in message ... Alot will depend on how you define an "item." Do you mean a cell containing any text? Something like this may do. You can nest a docvarialbe field in a macro button field to execute: Sub ScratchMacro() Dim oTbl As Word.Table Dim i& Dim rowCnt& Dim colCnt& Dim myVar As Variable Set oTbl = ActiveDocument.Tables(1) For rowCnt = 2 To oTbl.Rows.Count For colCnt = 1 To oTbl.Columns.Count If Len(oTbl.Cell(rowCnt, colCnt).Range.Text) 2 Then i = i + 1 End If Next colCnt Next rowCnt ActiveDocument.Variables("myVar").Value = i ActiveDocument.Fields.Update End Sub The field will look something like this: { Macrobutton Scratchmacro {DocVariable myVar}} -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Suzanne S. Barnhill wrote: You might want to have a look at http://gregmaxey.mvps.org/Table_Cell_Data.htm. If this macro doesn't do what you need, perhaps Greg could enhance it so that it would. I would think that any macro that could put information in the status bar could also write it to a document property or variable that could be picked up in the doc with a DocProperty or DocVariable field. "kaz" wrote in message oups.com... I have a field, outside of the table, that needs to display the count of the number of items in the table (excluding the header row). |
#14
|
|||
|
|||
Auto number a column in table using SEQ
Thanks for all your help. Fantastic help to me.
|
|
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Update a number field incrementally | AllyOop | Running & Setting Up Queries | 7 | February 22nd, 2006 12:38 PM |
page number positioning and format | tinaa | Page Layout | 3 | February 4th, 2006 12:38 AM |
Query is not updatable - | Doug Johnson via AccessMonster.com | Running & Setting Up Queries | 3 | January 21st, 2006 12:36 AM |
Need Subforms? | AccessRookie | Using Forms | 7 | April 8th, 2005 09:30 AM |
Using Validation to force entry into cells? | Mark | General Discussion | 16 | October 27th, 2004 09:23 PM |