xcelintern
New Member
- Joined
- Nov 16, 2016
- Messages
- 3
Excel: 2010
PP: 2010
PP Reference in Excel: enabled
Hi guys,
I started an internship 2 weeks ago and after a week of basic excel I've been thrust into VBA last week(I have no clue about it).
Everything I've learned and done so far has been thanks to forums and other websites like this but for this particular problem I was unable to find a solution that I could fit to my project.
I am using the following code in Excel VBA to start a Powerpoint presentation from Excel and after updating all the links (40+) and breaking them after it is supposd to save the PP under whatever name it extracted from excel.
Problem is: it only breaks the links on all the slides but not the one link on the slidemaster (master slide?). It does update it though. Any other suggestions for my frankensteined code would also be greatly appreciated.
The question I have about macros concerns the following line of code:
pApp.Run "Business Development 2016.pptm!Modul1.example macro"
This macro opens a window asking for an identification number (which i would like to extract and inject from my excel sheet as string) and then changing a picture on the title slide.
How could I adjust the code running the macro to also include the id number as string (which is present on excel sheet) that i now have to enter manually?
thanks in advance for your help, its greatly appreciated
PP: 2010
PP Reference in Excel: enabled
Hi guys,
I started an internship 2 weeks ago and after a week of basic excel I've been thrust into VBA last week(I have no clue about it).
Everything I've learned and done so far has been thanks to forums and other websites like this but for this particular problem I was unable to find a solution that I could fit to my project.
I am using the following code in Excel VBA to start a Powerpoint presentation from Excel and after updating all the links (40+) and breaking them after it is supposd to save the PP under whatever name it extracted from excel.
Problem is: it only breaks the links on all the slides but not the one link on the slidemaster (master slide?). It does update it though. Any other suggestions for my frankensteined code would also be greatly appreciated.
Code:
Sub OpenandsavecurrentPP()
Dim pApp As Object 'Powerpoint.Application'
Dim pPreso As Object
Dim sPreso As String
Dim objSlide As PowerPoint.Slide
Dim objShape As PowerPoint.Shape
' where the original pp is loaded '
sPreso = "M:\Business Development 2016.pptm"
On Error Resume Next
Set pApp = GetObject(, "PowerPoint.Application")
If Err.Number <> 0 Then
Set pApp = CreateObject("PowerPoint.Application")
pApp.Visible = True
End If
On Error Resume Next
Set pPreso = pApp.Presentations(sPreso)
If Err.Number <> 0 Then
Set pPreso = pApp.Presentations.Open(Filename:=sPreso)
End If
'where links are being updated'
On Error GoTo 0
pPreso.UpdateLinks
'If pPreso Is Nothing Then Exit Sub
'this is where the links are broken'
For Each objSlide In pPreso.slides
Application.StatusBar = "Breaking Object Links in " & pPreso.Name & ", slide: " & objSlide.Name
For Each objShape In objSlide.shapes
With objShape
If .Type = msoLinkedOLEObject Then
.LinkFormat.BreakLink
End If
End With
Next objShape
Set objShape = Nothing
Next objSlide
Set objSlide = Nothing
Application.StatusBar = True
pApp.Run "Business Development 2016.pptm!Modul1.example macro"
Dim FName As String
Dim FPath As String
'where pp is saved'
FPath = "M:\"
FName = Sheets("ge aktuell").Range("A1").Text
pApp.ActivePresentation.SaveAs FPath & FName & " BusinessDevelopment", 1
End Sub
The question I have about macros concerns the following line of code:
pApp.Run "Business Development 2016.pptm!Modul1.example macro"
This macro opens a window asking for an identification number (which i would like to extract and inject from my excel sheet as string) and then changing a picture on the title slide.
How could I adjust the code running the macro to also include the id number as string (which is present on excel sheet) that i now have to enter manually?
thanks in advance for your help, its greatly appreciated