A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Word » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Altering the Doc properties from inside a document



 
 
Thread Tools Display Modes
  #1  
Old May 21st, 2010, 02:23 PM posted to microsoft.public.word.docmanagement
Mumbly_Joe
external usenet poster
 
Posts: 1
Default 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  
Old May 21st, 2010, 02:34 PM posted to microsoft.public.word.docmanagement
Mumbly_Joe[_2_]
external usenet poster
 
Posts: 2
Default 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  
Old May 21st, 2010, 02:34 PM posted to microsoft.public.word.docmanagement
Graham Mayor
external usenet poster
 
Posts: 18,297
Default 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  
Old May 21st, 2010, 02:45 PM posted to microsoft.public.word.docmanagement
Graham Mayor
external usenet poster
 
Posts: 18,297
Default 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  
Old May 21st, 2010, 03:36 PM posted to microsoft.public.word.docmanagement
Mumbly_Joe[_2_]
external usenet poster
 
Posts: 2
Default 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  
Old May 21st, 2010, 04:12 PM posted to microsoft.public.word.docmanagement
Graham Mayor
external usenet poster
 
Posts: 18,297
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:53 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.