Picture Styles

Dan_W

Well-known Member
Joined
Jul 11, 2018
Messages
1,964
Office Version
  1. 365
Platform
  1. Windows
My understanding is that the preset Picture Styles (e.g., 'Bevel Perspective') is not available in VBA, but I was wondering if someone had gone to the effort of reverse engineering what values would need to be set to which settings in order to recreate an identical effect? I've tried this in the past, I will try and dig out the code to show how far I got, but it bore no resemblance to the preset Styles.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Is this what you want?

Select an image and run the macro below
Code:
Sub Bevel()
    With Selection.ShapeRange.ThreeD
        .BevelTopType = msoBevelRelaxedInset
        .BevelTopInset = 6
        .BevelTopDepth = 6
    End With
End Sub

If it is what you want ...
... record a macro creating the effects you want and adapt the auto-generated code to your specific needs
 
Upvote 0
Hi Yongle, thank you for taking the time to look over my query. Unfortuntately, it's not actually what I'm looking for - my apologies for not being clear. I was hoping that someone had already gone and reverse-engineered the settings/properties needed to reproduce exactly the 28 Picture Styles available under the 'Picture Format' menu.

The two styles I have tried to reproduce to-date both manually (with a macro recording) and programatically are "Bevel Perspective" and "Reflected Perspective Right", but the resulting images bear only a weak reseamblance to the originals. I feel like I'm missing something obvious. Thanks again, and do please let me know if you have any further thoughts.
 
Upvote 0
Something that may help (maybe??)
- I tested this method in a very simple way
- but SendKeys can be unreliable if there are other things going on in your code
- VBA races ahead of itself when waiting for tasks to finish
- use delaying tactics within your code to ensure that everything works in the correct sequence
etc

MANUALLY
This is the manual equivalent of what you want to replicate by VBA (test it - so that you see it working)
(A) Manually create an image and apply one of the the picture format styles (image1)
(B) Manually insert an image (image2)
(C) Next click on image1 and {CTRL}{SHIFT} c
(D) Next click on image2 and {CTRL}{SHIFT} v

SEMI-AUTOMATED
I tested the use of SendKeys to replicate (C) & (D) and it worked in a very simple uncomplicated test, where I ...
... manually selected a model image, ran macro ControlShiftC, manually selected new image , ran macro ControlShiftV
Code:
Sub ControlShiftC()
    SendKeys "^+c"
End Sub
Sub ControlShiftV()
    SendKeys "^+v"
End Sub

I did not manage to automate the 4 steps together, and am now out of time

FULLY AUTOMATE
If you can fully automate, then this may do what you want
- Insert 28 images in a sheet and picture format each one with a different style (Model1... Model28)
- use VBA to automate (A) (B) (C) (D)

Good luck
Please report back on your progress and post solution if successful
 
Last edited:
Upvote 0
Solution
I'm grateful to you for this - my apologies for not responding sooner, but I was travelling for the better part of the day.

It had occurred to me to use SendKeys, but I thought I'd do a check here first to see if anyone else knew of another solution. My personal preference is to avoid SendKeys, but at the end of the day, sometimes it's realistically the only tool available. That, and there are better things for us all to be doing.

Thank you kindly for taking the time to set out the instructions and to even jot down the corresponding code. I will not have a chance to work on the code for the rest of the week (code is on work laptop, currently on annual leave), but I will of course post my code on the off-chance someone else needs it.
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,147
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top