#1
|
|||
|
|||
Copy Properties
HI all.
I'm trying to get to grips with some basic VBA coding. So far I'm just looking at existing macro code and adding elements to my own recorded code. Trial and error and the VBA Help is useful...up to a point. The biggest problem is knowing what to search for, terminology wise. One area I would like to investigate is the ability to copy a property or properties from one element in a doc and apply it to the currently selected element. What should I be googling or typing in Help to get some info on this. Thanks in advance. Sark |
#2
|
||||
|
||||
Without knowing what 'property or properties' you're referring to and, similarly, what you mean by an 'element', it's impossible to say.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Ok...So say I wanted a macro that would copy and apply the formatting of a heading, or title, to any selected text within the document. The macro would function even if a new doc had a heading/title with different formatting.
I know there are other ways of doing this. I'm just trying to get to grips with the principles of using macros to copy and apply properties. Sark |
#4
|
||||
|
||||
Formatting is best handled through the appropriate use of Styles, not by overriding an existing Style's formatting with something else. So, if you want some selected text to have "the formatting of a heading, or title", the appropriate way would be to apply the relevant Style to the selection. No macros required. Yes, you could use a macro to apply a Style to a selection, but that seems overkill. Regardless, the macro would not "copy a property or properties from one element in a doc and apply it to the currently selected element" in the sense you envisaged.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
OK. Fair enough. I thought it might be possible to copy heading formatting and apply the formatting to selected text. This would allow different formatting of heading, from different docs to be copied without creating different styles.
I appreciate just copying a heading, then pasting and editing the text will do this. It was more an exercise in what I thought VBA could achieve. Thanks for posting. Sark |
#6
|
||||
|
||||
To copy Styles between documents, you'd ordinarily use the Organiser - and even that can be automated. For a basic example, see:
https://www.msofficeforums.com/word-...html#post38560 And, for something far more flexible (hence, complex), see: https://www.msofficeforums.com/word-...html#post28497
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
Thanks for that.. I'll investigate.
Sark |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Add custom doc properties in "Doc properties control" | eazysnatch | Word | 2 | 09-13-2017 08:08 PM |
When I copy&paste a second copy appears that can't be edited | makeo22 | Word | 3 | 04-26-2017 07:09 PM |
Copy/Paste with all Properties | mohsen.amiri | Word | 2 | 02-23-2015 08:55 PM |
Updating Document Properties without using advanced properties dialogue | thedr9wningman | Word VBA | 3 | 01-20-2014 05:56 PM |
Properties/Metadata | Digg | Word | 11 | 10-21-2013 02:29 PM |