98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft VBA Training and help » Setting Object Width as a percentage
Setting Object Width as a percentage
Resolved · Medium Priority · Version 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 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
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
VBA tip:Count the Rows and Columns in a SelectionIf you need to count the number of rows or columns in a worksheet use the following code: |