Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-23-2018, 08:24 AM
Sark Sark is offline Copy Properties Windows XP Copy Properties Office 2003
Novice
Copy Properties
 
Join Date: Apr 2017
Posts: 25
Sark is on a distinguished road
Default 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
Reply With Quote
  #2  
Old 03-23-2018, 03:04 PM
macropod's Avatar
macropod macropod is offline Copy Properties Windows 7 64bit Copy Properties Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #3  
Old 03-24-2018, 03:31 AM
Sark Sark is offline Copy Properties Windows XP Copy Properties Office 2003
Novice
Copy Properties
 
Join Date: Apr 2017
Posts: 25
Sark is on a distinguished road
Default

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
Reply With Quote
  #4  
Old 03-24-2018, 03:42 AM
macropod's Avatar
macropod macropod is offline Copy Properties Windows 7 64bit Copy Properties Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #5  
Old 03-24-2018, 03:52 AM
Sark Sark is offline Copy Properties Windows XP Copy Properties Office 2003
Novice
Copy Properties
 
Join Date: Apr 2017
Posts: 25
Sark is on a distinguished road
Default

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
Reply With Quote
  #6  
Old 03-24-2018, 11:07 PM
macropod's Avatar
macropod macropod is offline Copy Properties Windows 7 64bit Copy Properties Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #7  
Old 03-26-2018, 03:25 AM
Sark Sark is offline Copy Properties Windows XP Copy Properties Office 2003
Novice
Copy Properties
 
Join Date: Apr 2017
Posts: 25
Sark is on a distinguished road
Default

Thanks for that.. I'll investigate.

Sark
Reply With Quote
Reply

Thread Tools
Display Modes


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
Copy Properties 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
Copy Properties Updating Document Properties without using advanced properties dialogue thedr9wningman Word VBA 3 01-20-2014 05:56 PM
Copy Properties Properties/Metadata Digg Word 11 10-21-2013 02:29 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:27 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft