Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

setting object width percentage

Forum home » Delegate support and help forum » Microsoft VBA Training and help » Setting Object Width as a percentage

Setting Object Width as a percentage

ResolvedVersion 2003

Gregor has attended:
Excel Intermediate course

Setting Object Width as a percentage

I am creating a cimple Macro in Word. I have pasted in an Excel Object and want a macro that allows me to set the width of the object to 18.5 cm or 83%. This is easy to do, but when recording the macro the height defaults to 16.5cm (which is about 83% of the height of the object).

However, each object I paste into the Word document will be of different height (but the same width). Therefore the macro needs to set the object to 83% or 18.5cm and 83% of the height.

I have the following code in the macro:

Selection.InlineShapes(1).LockAspectRatio = msoTrue
Selection.InlineShapes(1).Height = 464.3
Selection.InlineShapes(1).Width = 524.4

How to I change the height to set to a percentage or change relative to a width of 524.4 (I am fairly new to VBA!).

Many thanks,

Gregor

RE: Setting Object Width as a percentage

Hi Gregor

With regards to your query it does fall beyond the scope of this forum as it is more consultancy related.

As you are new to VBA, you may want to review our Excel VBA Introduction training course which will provide a useful foundation to your VBA knowledge and may provide some useful pointers for your specific requirement.

for more information click here

If you would like to pursue the consultancy option then please advise so and we can follow up.

Regards

Jacob

Tue 21 Apr 2009: Automatically marked as resolved.

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

VBA tip:

Stop Screen Flickering When Running Code

Running VBA code may cause the screen to flicker as the monitor is the slowest part of the program and cannot keep up with the very fast changes taking place.

To switch off the screen until the program is run enter the following code line:

Application.ScreenUpdating = False

The screen comes on automatically on completion of the program.

View all VBA hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.11 secs.