PDA

View Full Version : 2003 macro want work in 2007 powerpoint



rwab
12-07-2011, 07:45 AM
I have 2007 power point now, in 2003 I could record a macro, but in 2007 ppt I cannot seem to find the control to record a macro and learned there is none?

The below macro worked in 2003, but does not work in 2007, its a simple fit to page function:

ActiveWindow.Selection.ShapeRange.ScaleWidth 1, msoFalse, msoScaleFromBottomRight
ActiveWindow.Selection.ShapeRange.ScaleHeight 1, msoFalse, msoScaleFromBottomRight
ActiveWindow.Selection.ShapeRange.ScaleWidth 1, msoFalse, msoScaleFromTopLeft
ActiveWindow.Selection.ShapeRange.ScaleHeight 1, msoFalse, msoScaleFromTopLeft
End Sub

Basically I copy a pdf file into ppt and want to expand it to a defined outline I already have created in ppt.

Any help here?

John Wilson
12-07-2011, 01:30 PM
What did you expect it to do?

Scaling by a factor of 1 usually does nothing.

rwab
12-08-2011, 08:03 AM
It did in ppt 2003 fit pdf import to outline in ppt................

John Wilson
12-08-2011, 08:28 AM
ScaleHeight 1 and ScaleWidth1 just set the height and width to the original height / Width x 1.

Here's the Object Model Entry
Shape.ScaleWidth Method
Scales the width of the shape by a specified factor. For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original size or relative to the current size. Shapes other than pictures and OLE objects are always scaled relative to their current width.
Syntax

expression.ScaleWidth(Factor, RelativeToOriginalSize, fScale)

expression A variable that represents a Shape object.

Parameters

Name Required/Optional Data Type Description

Factor Required Single Specifies the ratio between the width of the shape after you resize it and the current or original width. For example, to make a rectangle 50 percent larger, specify 1.5 for this argument.

RelativeToOriginalSize Required MsoTriState Specifies whether a shape is scaled relative to its current or original size.

fScale Optional MsoScaleFrom The part of the shape that retains its position when the shape is scaled.


If you saw something different in 2003 it was probably the different behaviour of placeholders.

rwab
12-08-2011, 01:04 PM
Sub TEST()
expression.ScaleWidth(Factor, RelativeToOriginalSize, fScale)
expression A variable that represents a Shape object.
End Sub

I could not get to work, I can send you the ppt, its basically a pdf copied into a ppt slide.

IN 2003 I just recored the above macro and it auto fit every slide

rwab
12-09-2011, 08:03 AM
Does anyone here know a good Powerpoint forum website where there are good amount of users and pros discussing and solving ppt 2007 issues? Thanks in advance for the tip.

John Wilson
12-09-2011, 08:25 AM
This is really not meant to be offensive.

Your Sub Test seems to indicate that you don't really understand code!

Have you considered:

Explaining exactly what you need to do
(forgetting the code you have so far)

Pretty sure one of the pros here will supply the code you need!

rwab
12-09-2011, 09:02 AM
Not to be offensive either, but you seem to be the only one on this site as it moves slowly, maybe I am missing something.

I write code all the time, but mostly in eXcEl............

The 2003 code is pretty simple, it expands an import file that is well copied into ppt, when you copy a file into ppt, it maintains its origin size and in this case from pdf.....

Like I said in an earlier post, I can send you the ppt file, not sure I could explain much more than this with providing the original code that worked in ppt 2003, I used this code for many years, but it does NOT work in 2007, in excel VBA 2003 code has to be altered for 2007 usage in some cases, the tweeks for excel I know, the tweeks for ppt I figured I'd try a forum...........otherwise I will have to invest a few hours to figure out myself, which I have already invested some time here with you(not to offend you), but can you or can't you, either way I am good, just cannot go back and forth again............time is money ya know mate..............

John Wilson
12-09-2011, 09:44 AM
I'll leave you to it then. For the record though I write Excel and PowerPoint code for multinationals all over the world and change Łthree figures / hour but as I said I'll leave you to it. As you (nearly) said your time is my money.

rwab
12-09-2011, 10:12 AM
I figured such a response from you, is 3 figures an hour something to brag about my friend, what a pitty for you, haha........?????????:rotlaugh:

John Wilson
12-09-2011, 10:19 AM
Yep And I figured your response too!
I wasn't bragging BTW just pointing out I was trying to help someone who doesn't know how to code and doesn't listen for free
You may now have the last word.

rwab
12-09-2011, 11:36 AM
4 minutes 32 seconds:

Dim shp As ShapeRange
If ActiveWindow.Selection.Type = ppSelectionShapes Then
Set shp = ActiveWindow.Selection.ShapeRange
shp.Left = 0
shp.Top = 0
shp.Height = ActivePresentation.PageSetup.SlideHeight
shp.Width = ActivePresentation.PageSetup.SlideWidth
End If
Set shp = Nothing


ps Get a new Gig mate !!!

John Wilson
12-09-2011, 01:21 PM
Yep, PetLahev CAN code. That's the correct code for 2003 too.

John Wilson
12-09-2011, 11:38 PM
I noticed though that you are now saying it didn't work (http://www.msofficeforums.com/powerpoint/9456-recording-macro-ppt-2007-a.html).
This is almost certainly because of the code you are using before Pet's code not leaving a selection active.

Try:
Dim oshp As Shape
Dim osld As Slide
Set osld = ActiveWindow.View.Slide
Set oshp = osld.Shapes(osld.Shapes.Count)
oshp.Left = 0
oshp.Top = 0
oshp.Height = ActivePresentation.PageSetup.SlideHeight
oshp.Width = ActivePresentation.PageSetup.SlideWidth
Set oshp = Nothing
Set osld = Nothing

rwab
12-11-2011, 06:35 PM
my 03 code did all pages auto-fit to an outline, not the hole page, this code does one to page and the 1 has 2 B highlighted.....my code not posted complete of all MAHT.

NO big deal...I got it to work.......:friends:

jqdx27
12-14-2011, 01:59 AM
PowerPoint Viewer 2007 lets you view full-featured presentations created in PowerPoint 97 and later versions. This viewer also supports opening password-protected Microsoft PowerPoint presentations. You can view and print presentations, but you cannot edit them in the PowerPoint Viewer 2007.