PC Review


Reply
Thread Tools Rate Thread

Altering the Doc properties from inside a document

 
 
Mumbly_Joe
Guest
Posts: n/a
 
      21st May 2010
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
 
Reply With Quote
 
 
 
 
Mumbly_Joe
Guest
Posts: n/a
 
      21st May 2010

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

 
Reply With Quote
 
Graham Mayor
Guest
Posts: n/a
 
      21st May 2010

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" <(E-Mail Removed)> wrote in message
news:37A8B23F-EEC9-4444-BE21-(E-Mail Removed)...
> 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



 
Reply With Quote
 
Graham Mayor
Guest
Posts: n/a
 
      21st May 2010
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" <(E-Mail Removed)> wrote in message
news:43F1B87C-823B-4875-A63B-(E-Mail Removed)...
>
> 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



 
Reply With Quote
 
Mumbly_Joe
Guest
Posts: n/a
 
      21st May 2010
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" <(E-Mail Removed)> wrote in message
> news:37A8B23F-EEC9-4444-BE21-(E-Mail Removed)...
> > 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

>
>
> .
>

 
Reply With Quote
 
Graham Mayor
Guest
Posts: n/a
 
      21st May 2010
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" <(E-Mail Removed)> wrote in message
news:E074CD54-0467-4035-918A-(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
>> news:37A8B23F-EEC9-4444-BE21-(E-Mail Removed)...
>> > 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

>>
>>
>> .
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
altering form's record navigating properties =?Utf-8?B?VGVk?= Microsoft Access 1 19th Aug 2005 10:02 PM
trouble altering page properties =?Utf-8?B?TWFyYw==?= Microsoft Frontpage 3 7th Aug 2005 07:29 PM
Problem after altering 'User Profiles' in System Properties! =?Utf-8?B?Sm9hbm5hIER1bmNl?= Windows XP Security 0 29th Oct 2004 03:12 AM
Reading/altering an .xml document Bob Robertson Microsoft Dot NET Framework 1 4th Sep 2004 06:09 PM
Altering FIle Properties Marrick Microsoft Excel Misc 1 23rd Dec 2003 11:44 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:03 AM.