Document Properties Powerpoint 2007 Visual Studio 2008


  • I have a form that is launched after a new PowerPoint presentation is created. The form has a number of text boxes that displays both built in and custom document properties. The user has an opportunity to modify the information and select OK to update the details. In VBA it was easy to populate the form, example below:

    With frmUpdateProperties
        With .txtTitle
            .Value = ActivePresentation.BuiltInDocumentProperties("Title")
            .SelStart = 0
            .SelLength = Len(.Text)
        End With
        .txtAuthor.Value = ActivePresentation.BuiltInDocumentProperties("Author")
        .txtApprovedBy.Value = ActivePresentation.CustomDocumentProperties("Approved_by")
    End With

    Also, when the user selected the OK button, then updating was done as below:

    With ActivePresentation
        .BuiltInDocumentProperties("Title") = txtTitle.Value
        .BuiltInDocumentProperties("Author") = txtAuthor.Value
        .CustomDocumentProperties("Approved_By") = txtApprovedBy.Value
    End With

    Having transferred the project to Visual Studio 2008 and using, I am having great difficulty in repeating the above.

    Any help/suggestions would be appreciated as I am not a programmer.

    Thanks in anticipation
    • 已移动 Cindy Meister MVPMVP 2009年11月6日 21:14 not about VSTO technology (From:Visual Studio Tools for Office)
    2009年11月5日 20:08


  • See if the information in this KB article helps

    303294  ( ) How to use automation to get and set Office document properties with Visual Basic .NET
    Cindy Meister, VSTO/Word MVP
    2009年11月6日 8:03
  • Cindy, thanks for link. Not being a programmer, I am having difficulty understanding what is required to be added/removed to/from the code when the form is loaded (see below). VBA was reasonably straight forward to understand.

        Private Sub frmUpdateProperties_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load


            Dim ppApp As Microsoft.Office.Interop.PowerPoint.Application

            Dim ppPres As Microsoft.Office.Interop.PowerPoint.Presentation


            ppApp = New Microsoft.Office.Interop.PowerPoint.Application

            ppPres = ppApp.ActivePresentation


            With Me

                With .txtPresentationTitle

                    .Text = ppPres.BuiltInDocumentProperties("Title")


                    .SelectionStart = 0

                    .SelectionLength = Len(.Text)

                End With

                .txtPresenter.Text = ppPres.BuiltInDocumentProperties("Author")

                .txtApprovedBy.Text = ppPres.CustomDocumentProperties("Approved_by")
            End With


        End Sub


    2009年11月6日 14:28
  • Since you don't give any details about what's going wrong there's not really anything I can do to help you. In any case, it appears you're not using the VSTO technology, so any help I try to provide may not help at all, only confuse the issue.

    The Please Read First message pinned at the top of the forum explains what VSTO is, what the VSTO forum supports and - most important for you - provides links to venues for non-VSTO, Office-related questions. Since you say you "aren't a programmer", the forums on MSDN aren't the best place for you to be looking for help - they target programmers. For that reason, I'm also not going to move you message to the Innovate on Office forum (although you're welcome to post there). But I think the best place for you to go is the PowerPoint newsgroup. There are people there who've made the VBA -> VB.NET transition and also know how their application works with properties. There's really little to no knowledge of the PowerPoint object model in the VSTO forum.
    Cindy Meister, VSTO/Word MVP
    2009年11月6日 21:14