|
-
Oct 5th, 2009, 09:42 AM
#1
Thread Starter
Junior Member
[resolved] macro actionsettings powerpoint 2007
What i'm trying to do:
I create a new index document, search a folder for files, add those files to my index and link them back to their respective paths (to open the files)
This worked fine in 2003, however with 2007 it stops somewhere in the code (as shown below)
Code:
With objShapes(objShapes.Count).TextFrame.WordWrap = msoFalse
.Tags.Add "Path", list(1, i)
With .ActionSettings.Item(ppMouseClick) <-- stops here!
.Action = ppActionRunMacro
.Run = "OpenDocument"
.AnimateAction = True
End With
End With
Any suggestions?
Last edited by Dragolin; Nov 24th, 2009 at 07:25 AM.
-
Oct 5th, 2009, 10:46 AM
#2
Addicted Member
Re: macro actionsettings powerpoint 2007
I believe the problem is that your first 'with' addresses the wordwrap property of the Textframe, then your second 'with' addresses the action settings, but it needs to refer to the shape, not the wordwrap property.
Try this:
vb Code:
With objShapes(objShapes.Count)
.TextFrame.WordWrap = msoFalse
.Tags.Add "Path", list(1, i)
With .ActionSettings.Item(ppMouseClick) <-- stops here!
.Action = ppActionRunMacro
.Run = "OpenDocument"
.AnimateAction = True
End With
End With
-
Oct 5th, 2009, 11:02 AM
#3
Thread Starter
Junior Member
Re: macro actionsettings powerpoint 2007
call me stupid, but I don't see any difference?
-
Oct 5th, 2009, 11:20 AM
#4
Addicted Member
Re: macro actionsettings powerpoint 2007
 Originally Posted by Dragolin
call me stupid, but I don't see any difference? 
Yours:
Code:
With objShapes(objShapes.Count).TextFrame.WordWrap = msoFalse
You are addressing the 'WordWrap' property.
Mine (NOTE - broken onto 2 lines):
Code:
With objShapes(objShapes.Count)
.TextFrame.WordWrap = msoFalse
I am addressing the shape - objShapes(objShapes.Count)
When you get to the second 'With' statement, yours effectively resolves to:
Code:
objShapes(objShapes.Count).TextFrame.WordWrap.ActionSettings.Item(ppMouseClick)
My code resolves to:
Code:
objShapes(objShapes.Count).ActionSettings.Item(ppMouseClick)
-
Oct 7th, 2009, 04:24 AM
#5
Thread Starter
Junior Member
Re: macro actionsettings powerpoint 2007
ok, thanks for pointing that out
however that was a bad paste on my side, the actual code does have the wordwrap on a seperate line ...
so there must be another problem
-
Oct 7th, 2009, 05:12 AM
#6
Re: macro actionsettings powerpoint 2007
however that was a bad paste on my side, the actual code does have the wordwrap on a seperate line ...
Can you upload your file for a faster resolution?
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Oct 7th, 2009, 08:09 AM
#7
Addicted Member
Re: macro actionsettings powerpoint 2007
 Originally Posted by Dragolin
ok, thanks for pointing that out
however that was a bad paste on my side, the actual code does have the wordwrap on a seperate line ...
so there must be another problem 
Can't say what the problem is, the code works properly for me (after making slight adjustments to substitute absolute objects for your variables). The only things I can suggest, is be sure that 'objShapes(objShapes.Count)' is a valid object, otherwise, you're going to have to upload a copy of the file you're using as koolsid suggested.
-
Oct 7th, 2009, 09:27 AM
#8
Thread Starter
Junior Member
-
Oct 7th, 2009, 09:35 AM
#9
Re: macro actionsettings powerpoint 2007
Hi Dragolin
Can you zip up your ppt and upload it?
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Oct 7th, 2009, 09:44 AM
#10
Thread Starter
Junior Member
Re: macro actionsettings powerpoint 2007
I'm afraid that's impossible, due to company internal information + you would need a specific folder structure the login tool scans for these documents
If you need any additional info, I'll try to post it as well
-
Oct 7th, 2009, 10:42 AM
#11
Addicted Member
Re: macro actionsettings powerpoint 2007
I tried to go through the code you posted, but there were too many variables that I don't know what their value would be.
The base code works for me. One thing I would suggest is instead of
vb Code:
With objShapes(objShapes.Count)
you set a variable to the shape that is created in the line directly before that and use that in your 'with' statement. Something like:
vb Code:
Dim objShape As PowerPoint.Shape
Set objShape = objShapes.AddPicture(DefaultLocation & "EggCartons.gif", msoFalse, msoCTrue, 650, 162 + (NrSelectedItems * 30) - (objPresentation.Slides.Count - 1) * 300, 25, 25)
With objShape
...
Edit - I think I might know what is going wrong - You set an object variable to the shapes on the slide (objShapes), then you add a shape without updating that variable. I believe it still only contains the shapes that existed when you set the variable. Using the above code should fix the problem if that is what it is.
Edit #2 - Nevermind, the objShapes variable does update when adding shapes.
Last edited by MarkWalsh; Oct 7th, 2009 at 10:48 AM.
-
Oct 26th, 2009, 10:40 AM
#12
Thread Starter
Junior Member
Re: macro actionsettings powerpoint 2007
any idea's as I'm still stuck with this problem
-
Oct 26th, 2009, 11:21 AM
#13
Re: macro actionsettings powerpoint 2007
Well you haven't given much to work upon so here is my last effort towards the problem...
Try this..
Tell me what happens?
Code:
With objShapes(objShapes.Count)
.TextFrame.WordWrap = msoFalse
.Tags.Add "Path", List(1, i)
With .ActionSettings(ppMouseClick) '<~~ Change this
.Action = ppActionRunMacro
.Run = "OpenDocument"
.AnimateAction = True
End With
End With
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Oct 27th, 2009, 03:50 AM
#14
Thread Starter
Junior Member
Re: macro actionsettings powerpoint 2007
with or without ".item" gives the same result, I tried that already ...
-
Oct 27th, 2009, 07:52 AM
#15
Addicted Member
Re: macro actionsettings powerpoint 2007
Your code is correct to add the action settings to a shape. Try running a test with just that code (select a shape, and run this code), and tell me if it works properly:
vb Code:
Sub test()
With ActivePresentation.Windows(1).Selection.ShapeRange(1)
'.Tags.Add "Path", List(1, i) ' NOTE - removed for testing
With .ActionSettings.Item(ppMouseClick) '<-- stops here!
.Action = ppActionRunMacro
.Run = "OpenDocument"
.AnimateAction = True
End With
End With
End Sub
If this works, then the problem is with another part of the code.
And I still think you'd be better off using a variable whenever you add a shape as I suggested, instead of using 'objShapes(objShapes.Count)'.
Last edited by MarkWalsh; Oct 27th, 2009 at 08:16 AM.
-
Nov 24th, 2009, 07:14 AM
#16
Thread Starter
Junior Member
Re: macro actionsettings powerpoint 2007
the solution was simple yet hard to find:
we were using a GetObject(Template) to call another presentation and now we fixed it using Application.Presentations.Open(FileName:=Template, withwindow:=False)
so it stopped on the code I showed you above, but that code was actually perfectly fine
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|