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 |
#1
|
|||
|
|||
Altering the Doc properties from inside a document
So my question might be a little convoluted but here goes nothing.
I'm trying to create a template that has some kind of textbox that changes the document property (specifically "category") to what ever has been typed in the box. I'm not really certain where to begin |
#2
|
|||
|
|||
Altering the Doc properties from inside a document
Ok, Maybe a better way to phrase this question is that I'm looking ot creat
some sort of textbox, field cell ect... that runs a macro when ever text is typed in it (A ma cro that will in this case change a doc property) "Mumbly_Joe" wrote: So my question might be a little convoluted but here goes nothing. I'm trying to create a template that has some kind of textbox that changes the document property (specifically "category") to what ever has been typed in the box. I'm not really certain where to begin |
#3
|
|||
|
|||
Altering the Doc properties from inside a document
If you add the following autonew macro to your document, it will prompt on
creating a new document and write what you enter in the box to the Category document property then update any fields in the document. If you are using a docproperty field elsewhere than in the main text area, you may need a more robust update routine to catch it - see http://www.gmayor.com/installing_macro.htm Sub AutoNew() Dim sCat As String sCat = InputBox("Enter category", "Category") ActiveDocument.BuiltInDocumentProperties("Category ").Value = sCat ActiveDocument.Fields.Update End Sub -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Mumbly_Joe" wrote in message ... So my question might be a little convoluted but here goes nothing. I'm trying to create a template that has some kind of textbox that changes the document property (specifically "category") to what ever has been typed in the box. I'm not really certain where to begin |
#4
|
|||
|
|||
Altering the Doc properties from inside a document
The simple expedient of typing text into some form of field is not going to
be sufficient to trigger the macro. You could run it on exit from a protected form field or a Word 2007 content control - even a table cell, but you have to take some specific action to trigger the macro that is more than simply typing. If the macro I suggested earlier is unsuitable, then let us know the purpose of the exercise. There may be a better solution. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Mumbly_Joe" wrote in message ... Ok, Maybe a better way to phrase this question is that I'm looking ot creat some sort of textbox, field cell ect... that runs a macro when ever text is typed in it (A ma cro that will in this case change a doc property) "Mumbly_Joe" wrote: So my question might be a little convoluted but here goes nothing. I'm trying to create a template that has some kind of textbox that changes the document property (specifically "category") to what ever has been typed in the box. I'm not really certain where to begin |
#5
|
|||
|
|||
Altering the Doc properties from inside a document
Thanks, that's really helpful, but I have a bit of a follow up question to
ask now. I'm putting together this template for some co-workers and the the feedback I've gotten is that that they want an easy way to change it at a later time. So let's say that it starts out as a "Blue" and then later down the line they need to change to a "Red". Now let's pretend it's difficult to modify a doc category manually, is there an easy way to make like a dutton on the doc that runs the maco again? "Graham Mayor" wrote: If you add the following autonew macro to your document, it will prompt on creating a new document and write what you enter in the box to the Category document property then update any fields in the document. If you are using a docproperty field elsewhere than in the main text area, you may need a more robust update routine to catch it - see http://www.gmayor.com/installing_macro.htm Sub AutoNew() Dim sCat As String sCat = InputBox("Enter category", "Category") ActiveDocument.BuiltInDocumentProperties("Category ").Value = sCat ActiveDocument.Fields.Update End Sub -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Mumbly_Joe" wrote in message ... So my question might be a little convoluted but here goes nothing. I'm trying to create a template that has some kind of textbox that changes the document property (specifically "category") to what ever has been typed in the box. I'm not really certain where to begin . |
#6
|
|||
|
|||
Altering the Doc properties from inside a document
Yes - just run the macro again - see how to add a macro to a button at
http://www.gmayor.com/installing_macro.htm -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Mumbly_Joe" wrote in message ... Thanks, that's really helpful, but I have a bit of a follow up question to ask now. I'm putting together this template for some co-workers and the the feedback I've gotten is that that they want an easy way to change it at a later time. So let's say that it starts out as a "Blue" and then later down the line they need to change to a "Red". Now let's pretend it's difficult to modify a doc category manually, is there an easy way to make like a dutton on the doc that runs the maco again? "Graham Mayor" wrote: If you add the following autonew macro to your document, it will prompt on creating a new document and write what you enter in the box to the Category document property then update any fields in the document. If you are using a docproperty field elsewhere than in the main text area, you may need a more robust update routine to catch it - see http://www.gmayor.com/installing_macro.htm Sub AutoNew() Dim sCat As String sCat = InputBox("Enter category", "Category") ActiveDocument.BuiltInDocumentProperties("Category ").Value = sCat ActiveDocument.Fields.Update End Sub -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Mumbly_Joe" wrote in message ... So my question might be a little convoluted but here goes nothing. I'm trying to create a template that has some kind of textbox that changes the document property (specifically "category") to what ever has been typed in the box. I'm not really certain where to begin . |
Thread Tools | |
Display Modes | |
|
|