Solved

in MS Word VBA How can I apply one of the picture styles that appears on the ribbon for pictures

Posted on 2013-01-27
7
513 Views
Last Modified: 2013-01-28
it seems that the picture styles listed on the ribbon are made up of a complex recipe of effects. Although Microsoft makes available the individual effects through vba that is not helpful enough because I don't have the time to figure out which efects to combine to get the beautiful picture styles Microsoft offers in its ribbon.

Using the macro recorder is of no use because it doesn't work when applying picture styles. Is there any place that reveals the secret ingredient of effects used to create the ribbon styles or is there away of applying them progromaticly using autohotkeys or some kind of scripting program? Keep in mind that I may have up to 200 pictures in a single word document to which I wish to aply the style to.
0
Comment
Question by:Dov_B
  • 3
  • 3
7 Comments
 
LVL 59

Expert Comment

by:Chris Bottomley
Comment Utility
Don't know if I can answer yet but what are you looking for, to apply a given style using VBA or to create your own style at run time?

Chris
0
 

Author Comment

by:Dov_B
Comment Utility
TO APPLY A GIVEN STYLE USING vba
0
 
LVL 59

Assisted Solution

by:Chris Bottomley
Chris Bottomley earned 50 total points
Comment Utility
For a selection then try:

    Application.Selection.Style = ActiveDocument.Styles("Heading 1")

Alternativly to apply a paragraph style try:

    Application.Selection.Paragraphs(1).Style = ActiveDocument.Styles("Heading 1")

Chris
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:Dov_B
Comment Utility
Thanks but I mean picture styles
0
 
LVL 59

Expert Comment

by:Chris Bottomley
Comment Utility
ok, apologies.  i've never used anything of the sort and cannot say I have ever heard of or seen them.

Looking around at the interface and on t' web however the short answer seems to be no you cannot short of breaking down the effects of the style you want and applying each of the component properties independantly.

Chris
0
 

Author Comment

by:Dov_B
Comment Utility
I just had a thought perhaps after applying a picture style there is a way to cycle through all its properties and list them in the debug window so I can easily write a macro that sets all the appropriate properties to match the picture style
0
 
LVL 16

Accepted Solution

by:
kmslogic earned 450 total points
Comment Utility
You could put a single image in a document, format it how you want and then put

ActiveDocument.InlineShapes(1)

As a watch in the VBA editor for all modules.  From there you can expland it and look at the settings under things like pictureformat, reflection, etc. to get the settings you need.  You could then iterate through the inlineshapes in your actual document to adjust the images there.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Introduction Authors who set out to write any sort of lengthy piece for online submission—be it a long question or comment on a technical form, an article, or a substantial blog entry—often find it useful to work up a draft in an editor other t…
This is written from a 'VBA for MS Word' perspective, but I am sure it applies to most other MS Office components where VBA is used.  One thing that really bugs me is slow code, ESPECIALLY when it's mine!  In programming there are so many ways to…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now