Document Properties Powerpoint 2007 Visual Studio 2008 vb.net
- 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")
.SetFocus
.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 vb.net, I am having great difficulty in repeating the above.
Any help/suggestions would be appreciated as I am not a programmer.
Thanks in anticipation
Nigel- Moved byCindy MeisterMVPFriday, November 06, 2009 9:14 PMnot about VSTO technology (From:Visual Studio Tools for Office)
All Replies
- See if the information in this KB article helps
303294 (http://support.microsoft.com/kb/303294/ ) How to use automation to get and set Office document properties with Visual Basic .NET
Cindy Meister, VSTO/Word MVP - 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")
.Focus()
.SelectionStart = 0
.SelectionLength = Len(.Text)
End With
.txtPresenter.Text = ppPres.BuiltInDocumentProperties("Author")
.txtApprovedBy.Text = ppPres.CustomDocumentProperties("Approved_by")
etc
etc
End WithEnd Sub
- 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

