-
Apr 27th, 2017, 03:31 PM
#1
Thread Starter
New Member
Writing a Macro in Powerpoint
Hi everyone,
I have a quick question regarding how to write a macro in power point. I am trying to change the color of the page number in the bottom right of every slide from grey to white.
What would be the macro for this? Thank you!
I've already tried slide master, but because of formatting issues in the slides, it does not carry through for every single slide.
-
Apr 27th, 2017, 03:50 PM
#2
Re: Writing a Macro in Powerpoint
How are you numbering the slides? Are you letting PowerPoint number them in a Header/Footer, or manually entering the page number, or some other method?
Possibly useful links:
https://msdn.microsoft.com/en-us/lib.../ff745854.aspx
https://msdn.microsoft.com/en-us/lib.../ff744240.aspx
-
Apr 28th, 2017, 07:01 AM
#3
Thread Starter
New Member
Re: Writing a Macro in Powerpoint
Originally Posted by jdc2000
I am letting Powerpoint number them via insert slide number/apply to all. Thanks!
-
May 1st, 2017, 05:14 PM
#4
Re: Writing a Macro in Powerpoint
Possibly useful links:
https://nutsandboltsspeedtraining.co...in-powerpoint/
https://www.pcreview.co.uk/threads/c...h-vba.3475092/
https://msdn.microsoft.com/en-us/lib.../ff822794.aspx
Note: If you have some macro code that you are using now, and that is not working, post it here inside of some Code tags so we can see what you are using.
Last edited by jdc2000; May 1st, 2017 at 05:18 PM.
-
May 2nd, 2017, 07:40 AM
#5
Re: Writing a Macro in Powerpoint
I don't work with Powerpoint much, but this seems to work, at least for my simple example presentation:
Code:
Sub changeFont()
Dim pres As Presentation
Dim sld As Slide
Dim shp As Shape
Set pres = ActivePresentation
For Each sld In pres.Slides
For Each shp In sld.Shapes
If shp.Name = "Slide Number Placeholder 1" Then
shp.TextFrame.TextRange.Font.Color = 16777215
Exit For
End If
Next
Next
End Sub
-
Jun 13th, 2017, 04:40 AM
#6
New Member
Re: Writing a Macro in Powerpoint
I used this method which I found on another forum and it worked quite well for this
You can try this one:
Dim PPApp As Object 'late binding
Dim PPPres As Object
Dim PPSlide As Object
Dim db As Database, rs As Recordset
Dim strSql As String
Set PPApp = GetObject(, "PowerPoint.Application")
If PPApp Is Nothing Then 'no existing application is running
Set PPApp = CreateObject("PowerPoint.Application")
End If
If PPApp Is Nothing Then 'not able to create the application
MsgBox "The application is not available!",
vbExclamation+vbOKOnly,"Help."
End If
'Open up a recordset on the employee table.
Set db = CurrentDb
strSql = "SELECT * From [Employee] WHERE (Status = True);"
Set rs = db.OpenRecordset(strSql)
Set PPPres = PPApp.Presentations.Add
With PPApp
While Not rs.EOF
With PPPres.Slides
Set PPSlide = .Add(rs.AbsolutePosition + 1, 2)
PPSlide.HeadersFooters.Footer.Visible = True
PPSlide.HeadersFooters.Footer.Text = "My Footer Text Here."
PPSlide.HeadersFooters.DateAndTime.Visible = True
PPSlide.HeadersFooters.DateAndTime.UseFormat = True
PPSlide.HeadersFooters.DateAndTime.Format = 1
PPSlide.HeadersFooters.SlideNumber.Visible = True
PPSlide.Shapes(1).TextFrame.TextRange.Text =
UCase(CStr(rs.Fields("EmployeeID").value))
PPSlide.Shapes(2).TextFrame.TextRange.Text = "Name =
" & CStr(rs.Fields("FirstName").value) & vbCrLf & _
"Surname = " & CStr(rs.Fields("Surname").value)& vbCrLf & _
"Phone = " & CStr(rs.Fields("Phone").value) & vbCrLf & _
"Level = " & CStr(rs.Fields("Level").value)
PPSlide.Shapes(1).TextFrame.TextRange.Characters.Font.Size = 30
PPSlide.Shapes(2).TextFrame.TextRange.Characters.Font.Size = 26
PPSlide.Shapes(2).TextFrame.TextRange.Characters.Font.Color =
vbBlue
End With
rs.MoveNext
Wend
End With
PPPres.SlideShowSettings.Run
Set PPApp = Nothing
Set PPSlide = Nothing
Set PPPres = Nothing
End If
End If
Let me know how it goes, however recently I've been using some other alternatives to powerpoint. Simpler to use although not as much functionality usually.
However I keep switching between Powerpoint and Google Slides, since on Google slides it's always automatically backed up on the cloud.
Prezi was a quite good one aswell, however is like child play now compares to the other pieces of software
Last edited by Trdrego; Jun 13th, 2017 at 04:43 AM.
Reason: add some details
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
|