[Blocked Image: https://www.ozgrid.com/forum/core/index.php?attachment/1230378-pasted-from-clipboard-png/&thumbnail=1]
bottom 4 are changed successfully for macro-enabled worksheets
But not top 4 links that are calling charts are not changed.
[Blocked Image: https://www.ozgrid.com/forum/core/index.php?attachment/1230378-pasted-from-clipboard-png/&thumbnail=1]
bottom 4 are changed successfully for macro-enabled worksheets
But not top 4 links that are calling charts are not changed.
Good to hear there is good progress
Regarding the chart links ... it could be related to the way you have picked to link your Excel charts to your PowerPoint presentation ...
Have you noticed within the code that the type msoLinkedChart does not exist ... and has to be replaced by msoLinkedGraphic ...
Hope this will help
To be on the safe side ... you could look for the solution you have picked among the 3 possibilities :
1. Picture
2. OLEObject
3. Graphic Object ( the most robust one)
I know you wont be able to compile the code i have sent, but could you edit it so I understand how to call Graphic Object ?
I have added both, still can't get it to edit the link to the charts. The way I added the chart to ppt is by copying and paste special with 'source formatting and link data'
'Loop through each slide in the presentation
For Each pptSlide In pptPresentation.Slides
'Loop through each shape in each slide
For Each pptShape In pptSlide.Shapes
'Find out if the shape is a linked object or a linked picture
If pptShape.Type = msoLinkedPicture Or pptShape.Type = msoLinkedOLEObject Or pptShape.Type = msoLinkedChart Or pptShape.Type = msoLinkedDesign Then
'Use Replace to change the oldFilePath to the newFilePath
pptShape.LinkFormat.SourceFullName = Replace(LCase(pptShape.LinkFormat.SourceFullName), LCase(oldFilePath), newFilePath)
End If
Next
Next
Display More
Below is the proposed modification to be tested :
'Loop through each slide in the presentation
For Each pptSlide In pptPresentation.Slides
'Loop through each shape in each slide
For Each pptShape In pptSlide.Shapes
'Find out if the shape is a linked object or a linked picture
If pptShape.Type = msoLinkedPicture Or pptShape.Type _
= msoLinkedOLEObject Or pptShape.Type = msoLinkedGraphic Then
'Use Replace to change the oldFilePath to the newFilePath
pptShape.LinkFormat.SourceFullName = Replace(LCase _
(pptShape.LinkFormat.SourceFullName), LCase(oldFilePath), newFilePath)
End If
Next pptShape
Next pptSlide
Display More
You will notice on Line 7 that the type msoLinkedChart has been replaced by msoLinkedGraphic
Hope this will help
Once you have tested the macro ... feel free to share your feedback
That didn't work, I am afraid.
I shall send you the ppt and excel duo asa I am on my laptop to see if you can fix it.
I have deadline to mid day today to deliver it to the teams.
I tried to test the code on another set of ppt/excel, it didn't even change the worksheets so beginning to doubt the code.
I had written the code in module2, should I have appended it in module1?
The module where the macro is located does not have any impact on the macro 's effectiveness...
However, a crucial point is the following :
Alt F11 to get to VBE
From the main menu ... select Tools > References
Go down the long list of librairies to select Microsoft Powerpoint xx.x Object Library
Indeed, this library contains all the code required to allow Excel to control Powepoint
Hope this will help
Hi Carim
Please see the files.
Charts are not updating but worksheets are.
I had already selected the powerpoint from the library for early binding.
I am also beginning to think the code can be matured to not need the old excel location - if you like to try your hands on !
I am late in sending this to you but would be ever so grateful if you could have an early look at it.
I tried adding pptShape.Type = msoCharts but linking in the next code line failed
'Find out if the shape is a linked object or a linked picture
If pptShape.Type = msoLinkedPicture Or pptShape.Type = msoLinkedOLEObject Or pptShape.Type = msoLinkedChart Or pptShape.Type = msoLinkedDesign Or pptShape.Type = msoCharts Then
'Use Replace to change the oldFilePath to the newFilePath
pptShape.LinkFormat.SourceFullName = Replace(LCase(pptShape.LinkFormat.SourceFullName), LCase(oldFilePath), newFilePath)
You Excel file does not contain your macro ...!!!!
dont know why ! uploading again
what do you think Carim ? sorry rushing you !
It worked ! I had to add \ at the end of the path
Glad to hear you have managed to sort it out ...!!!
Well Done !!!
Hi Carim, it somehow worked and saved my rapport in front of the team... but any further attempts it's not working. No debugging errors but not doing what its supposed to.
Coul you please have a quick look for me ?
As soon as I have a moment ... will take a look ...
But ... you will admit with me ... when it comes to computing, say a macro ... it either works or it doesn't ... rarely something in-between
I admit - I was trying loads of things - one of which may have worked but I cant figure out which may have !!
Should the links have \ at the end ?
Don’t have an account yet? Register yourself now and be a part of our community!