VBA and PowerPoint Issue

JackMDaniels

New Member
Joined
Feb 10, 2014
Messages
24
Hi All

I'm having a problem running a macro I had made, it was initially made for a different PowerPoint Document but I've dropped new content in and I'm getting this error, if anyone could shed some light with a resolution I'd be eternally grateful :)

Code:
 Option Explicit

Private Sub CmdAdd_Click()
Dim SldM            As Master
Dim Sld             As Slide
Dim LngCounter      As Long


Set Sld = ActivePresentation.Slides("Slide90")
    
    Sld.Shapes(5).Table.Cell(1, 2).Shape.TextFrame.TextRange.Text = Me.txtVersion & "/" & Me.txtStatus
    Sld.Shapes(5).Table.Cell(2, 2).Shape.TextFrame.TextRange.Text = Me.txtDate
    Sld.Shapes(5).Table.Cell(3, 2).Shape.TextFrame.TextRange.Text = Me.txtOwner
    Sld.Shapes(5).Table.Cell(4, 2).Shape.TextFrame.TextRange.Text = Me.txtCreator
    Sld.Shapes(5).Table.Cell(5, 2).Shape.TextFrame.TextRange.Text = Me.txtFunction
    Sld.Shapes(5).Table.Cell(6, 2).Shape.TextFrame.TextRange.Text = Me.txtApprover
    Sld.Shapes(5).Table.Cell(7, 2).Shape.TextFrame.TextRange.Text = Me.txtDocID
    Sld.Shapes(5).Table.Cell(8, 2).Shape.TextFrame.TextRange.Text = Me.txtDocLocation
    
Set Sld = Nothing


Set SldM = ActivePresentation.Designs(1).SlideMaster
    SldM.Shapes(26).TextFrame.TextRange.Text = "Copyright 2014 Nokia - " & Me.txtFileName & " - v." & Me.txtVersion & " - " & Me.txtCreator & " - " & Me.txtDocID
    SldM.Shapes(28).TextFrame.TextRange.Text = Me.cmbClassification
Set SldM = Nothing
Set SldM = ActivePresentation.Designs(2).SlideMaster
    SldM.Shapes(25).TextFrame.TextRange.Text = "Copyright 2014 Nokia - " & Me.txtFileName & " - v." & Me.txtVersion & " - " & Me.txtCreator & " - " & Me.txtDocID
    SldM.Shapes(26).TextFrame.TextRange.Text = Me.cmbClassification
Set SldM = Nothing


If CLng(Application.Version = 11) Then
    For LngCounter = 3 To 6
        Set SldM = ActivePresentation.Designs(LngCounter).SlideMaster
            SldM.Shapes(23).TextFrame.TextRange.Text = "Copyright 2014 Nokia - " & Me.txtFileName & " - v." & Me.txtVersion & " - " & Me.txtCreator & " - " & Me.txtDocID
            SldM.Shapes(24).TextFrame.TextRange.Text = Me.cmbClassification
        Set SldM = Nothing
        DoEvents
    Next
End If


MsgBox "Metadata slide updated", vbOKOnly + vbInformation, "Nokia"
Unload Me


End Sub




Private Sub UserForm_Activate()
Dim Sld             As Slide
Dim SldM            As Master
Dim StrContainer    As String


With cmbClassification
    .AddItem " ", 0
    .AddItem "Public", 1
    .AddItem "For internal use", 2
    .AddItem "Confidential", 3
    .AddItem "Secret", 4
End With


Set Sld = ActivePresentation.Slides("Slide90")
    
[COLOR=#ff0000]    StrContainer = Sld.Shapes(5).Table.Cell(1, 2).Shape.TextFrame.TextRange.Text[/COLOR]
    If InStr(1, StrContainer, "/") <> 0 Then
        Me.txtVersion = Trim(Left(StrContainer, InStr(1, StrContainer, "/") - 1))
        Me.txtStatus = Trim(Right(StrContainer, Len(StrContainer) - InStr(1, StrContainer, "/")))
    End If
    Me.txtDate = Sld.Shapes(5).Table.Cell(2, 2).Shape.TextFrame.TextRange.Text
    Me.txtOwner = Sld.Shapes(5).Table.Cell(3, 2).Shape.TextFrame.TextRange.Text
    Me.txtCreator = Sld.Shapes(5).Table.Cell(4, 2).Shape.TextFrame.TextRange.Text
    Me.txtFunction = Sld.Shapes(5).Table.Cell(5, 2).Shape.TextFrame.TextRange.Text
    Me.txtApprover = Sld.Shapes(5).Table.Cell(6, 2).Shape.TextFrame.TextRange.Text
    Me.txtDocID = Sld.Shapes(5).Table.Cell(7, 2).Shape.TextFrame.TextRange.Text
    Me.txtDocLocation = Sld.Shapes(5).Table.Cell(8, 2).Shape.TextFrame.TextRange.Text
    
Set Sld = Nothing


Set SldM = ActivePresentation.SlideMaster
    StrContainer = SldM.Shapes(26).TextFrame.TextRange.Text
    StrContainer = Right(StrContainer, Len(StrContainer) - 23)
    If InStr(1, StrContainer, " - v.") > 5 Then
        Me.txtFileName = Trim(Left(StrContainer, InStr(1, StrContainer, " - v.") - 1))
    End If
    Me.cmbClassification = SldM.Shapes(28).TextFrame.TextRange.Text
Set SldM = Nothing


End Sub

http://imgur.com/y95XQsp
http://imgur.com/C5zJzx6
 
Last edited:

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,215,442
Messages
6,124,886
Members
449,194
Latest member
ronnyf85

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top