Good afternoon, I'm automating a PowerPoint presentation and need to put the relevant country's flag in certain slides. I am more than prepared to be shot down in flames over this code, but I had to start somewhere:-
Previously I had been trying to "amend the fill" of an existing object called "Country Logo" with the following code:-
But that didn't work! Apparently you can't change the fill - it didn't fall over, it just didn't change the fill.
Ideally I'd like to be able to:-
1) Select the country from some sort of drop-down list.
2) Delete the object/shape "Country Logo" and then rename the newly inserted picture as that; otherwise I just get a whole stack of new pictures sitting on top of each other.
I'm also sure that there must also be a better way of getting the picture & then copying & pasting it. (Slides 1 & 13 have the flag in the same place, as do Slides 2 & 7 - 12.)
Any help will be gratefull received.
Many thanks,
D€$
Code:
Sub NewFlags()
Country = InputBox("Enter Country", "Enter Country")
Path = "G:\folder\folder\Charts and images\Country Flags\"
''Country = "Sweden"
With ActivePresentation.Slides.Range("Slide 1")
.Shapes.AddPicture Path & Country & ".png", False, True, 20, 405, 53, 53
End With
With ActivePresentation.Slides.Range("Slide 13")
.Shapes.AddPicture Path & Country & ".png", False, True, 20, 405, 53, 53
End With
With ActivePresentation.Slides.Range("Slide 2")
.Shapes.AddPicture Path & Country & ".png", False, True, 730, 0, 48, 48
End With
For S = 7 To 12 'Slides 7 to 12
With ActivePresentation.Slides.Range("Slide " & S)
.Shapes.AddPicture Path & Country & ".png", False, True, 730, 0, 48, 48
End With
Next S
End Sub
Previously I had been trying to "amend the fill" of an existing object called "Country Logo" with the following code:-
Code:
Set shp = .Shapes("Country Logo")
Country = "South Africa"
Select Case Country
Case "South Africa"
CountryFlag = "South Africa"
Case "India"
CountryFlag = "India"
End Select 'Select Case country
'' MsgBox shp.Fill.Type ' = 6
Call shp.Fill.UserPicture("G:\CONNECT\Useful documents\Charts and images\Country Flags\" & CountryFlag & ".png")
But that didn't work! Apparently you can't change the fill - it didn't fall over, it just didn't change the fill.
Ideally I'd like to be able to:-
1) Select the country from some sort of drop-down list.
2) Delete the object/shape "Country Logo" and then rename the newly inserted picture as that; otherwise I just get a whole stack of new pictures sitting on top of each other.
I'm also sure that there must also be a better way of getting the picture & then copying & pasting it. (Slides 1 & 13 have the flag in the same place, as do Slides 2 & 7 - 12.)
Any help will be gratefull received.
Many thanks,
D€$