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:
.Value = ActivePresentation.BuiltInDocumentProperties("Title")
.SelStart = 0
.SelLength = Len(.Text)
.txtAuthor.Value = ActivePresentation.BuiltInDocumentProperties("Author")
.txtApprovedBy.Value = ActivePresentation.CustomDocumentProperties("Approved_by")
Also, when the user selected the OK button, then updating was done as below:
.BuiltInDocumentProperties("Title") = txtTitle.Value
.BuiltInDocumentProperties("Author") = txtAuthor.Value
.CustomDocumentProperties("Approved_By") = txtApprovedBy.Value
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
- 已移动 Cindy Meister MVPMVP 2009年11月6日 21:14 not about VSTO technology (From:Visual Studio Tools for Office)
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
.Text = ppPres.BuiltInDocumentProperties("Title")
.SelectionStart = 0
.SelectionLength = Len(.Text)
.txtPresenter.Text = ppPres.BuiltInDocumentProperties("Author")
.txtApprovedBy.Text = ppPres.CustomDocumentProperties("Approved_by")
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