Can anyone help please?
I have a piece of code in VB.Net that populates information into the SlideMaster of a presentation. The issue I have is that once the information has been populated the SlideMaster does not close and revert back to Normal view.
The code is held in a class of general functions where I pass in the presentation. Is there a way of changing the view to Normal using the presentation. I have taken a look and it appears that I can change the WindowState but only using the application.
Thanks in advance.
Jack
Closing SlideMaster, PowerPoint 2007
-
- Administrator
- Posts: 78241
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Closing SlideMaster, PowerPoint 2007
In Visual Basic, it isn't necessary to switch to Master view in order to manipulate the master. You can set text, add shapes etc. directly, without changing the view.
Best wishes,
Hans
Hans
-
- 2StarLounger
- Posts: 107
- Joined: 23 Mar 2010, 13:42
Re: Closing SlideMaster, PowerPoint 2007
The design company who put the Presentation I need to include in this solution have placed the copyright in the Master so that users cannot delete. I need to check the information and change if they necessary.
Regards
Jack
Regards
Jack
-
- Administrator
- Posts: 78241
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Closing SlideMaster, PowerPoint 2007
I'm not sure I understand.
You can do something like this without actually displaying the slide master:
ActivePresentation.SlideMaster.HeadersFooters.Footer.Text = "Eileen's Lounge 2010"
or
ActivePresentation.SlideMaster.Shapes.AddLine 10, 100, 400, 100
You can do something like this without actually displaying the slide master:
ActivePresentation.SlideMaster.HeadersFooters.Footer.Text = "Eileen's Lounge 2010"
or
ActivePresentation.SlideMaster.Shapes.AddLine 10, 100, 400, 100
Best wishes,
Hans
Hans
-
- 2StarLounger
- Posts: 107
- Joined: 23 Mar 2010, 13:42
Re: Closing SlideMaster, PowerPoint 2007
I can access the SlideMaster (as this is the only location I can make the change on that particular textbox), cycle through until I find the appropriate textbox, update the information. The problem I have is that the rest of the code runs, task pane closes but I am left in the newly created PowerPoint presentation in SlideMaster view rather than Normal view.
Thanks
Jack
Thanks
Jack
-
- Administrator
- Posts: 12577
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: Closing SlideMaster, PowerPoint 2007
Jack,Jack21 wrote:...I am left in the newly created PowerPoint presentation in SlideMaster view rather than Normal view...
If you want to change the slide master from VBA then there is absolutely no need to go in to SlideMaster view, you can just use appropriate code to change the slide master while remaining in Normal view.
It might help if you post the code you are using here.
StuartR
-
- 2StarLounger
- Posts: 107
- Joined: 23 Mar 2010, 13:42
Re: Closing SlideMaster, PowerPoint 2007
I think I might be confusing matters !! This is the piece of code I call:
Public Shared Sub populatePresentationFooter(ByVal strName As String, ByVal prePresentation As PowerPoint.Presentation, ByVal strPresentationTitle As String, ByVal _userManager As UserManager)
For lngCount As Integer = 1 To prePresentation.SlideMaster.Shapes.Count
Dim strText As String = prePresentation.SlideMaster.Shapes(lngCount).TextFrame.TextRange.Text
If strText = "© 2010 Smith LLP. Private and confidential." Then
For lngProfile As Integer = 0 To _userManager.Profiles.Count - 1
If _userManager.Profiles(lngProfile).Name = strName Then
Dim strCopyright As String = "© " & Format(Date.Today, "yyyy") & " " & _userManager.Profiles(lngProfile).LegalEntity & ". All rights reserved."
prePresentation.SlideMaster.Shapes(lngCount).TextFrame.TextRange.Text = strCopyright
End If
Next
End If
Next
End Sub
This works perfectly well but, as mentioned, the SlideMaster view stays open once the presentation has populated.
Regards
Jack
Public Shared Sub populatePresentationFooter(ByVal strName As String, ByVal prePresentation As PowerPoint.Presentation, ByVal strPresentationTitle As String, ByVal _userManager As UserManager)
For lngCount As Integer = 1 To prePresentation.SlideMaster.Shapes.Count
Dim strText As String = prePresentation.SlideMaster.Shapes(lngCount).TextFrame.TextRange.Text
If strText = "© 2010 Smith LLP. Private and confidential." Then
For lngProfile As Integer = 0 To _userManager.Profiles.Count - 1
If _userManager.Profiles(lngProfile).Name = strName Then
Dim strCopyright As String = "© " & Format(Date.Today, "yyyy") & " " & _userManager.Profiles(lngProfile).LegalEntity & ". All rights reserved."
prePresentation.SlideMaster.Shapes(lngCount).TextFrame.TextRange.Text = strCopyright
End If
Next
End If
Next
End Sub
This works perfectly well but, as mentioned, the SlideMaster view stays open once the presentation has populated.
Regards
Jack
-
- Administrator
- Posts: 78241
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Closing SlideMaster, PowerPoint 2007
Unfortunately, the ViewType property is read-only in PowerPoint VBA, so you can't change it to set normal view.
There's some tricky code for PowerPoint 2002/2003 in How to activate the tab of choice (Outline/Slides) in PowerPoint 2002 and later but I don't know how to modify that for PowerPoint 2007.
There's some tricky code for PowerPoint 2002/2003 in How to activate the tab of choice (Outline/Slides) in PowerPoint 2002 and later but I don't know how to modify that for PowerPoint 2007.
Best wishes,
Hans
Hans
-
- Administrator
- Posts: 12577
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: Closing SlideMaster, PowerPoint 2007
I can't test that code as I don't have the matching context, but if I run a simplified version that just doesJack21 wrote:...This works perfectly well but, as mentioned, the SlideMaster view stays open once the presentation has populated...
Code: Select all
Sub Text()
Dim strCopyright As String
strCopyright = "Test text for footer"
ActivePresentation.SlideMaster.Shapes(4).TextFrame.TextRange.Text = strCopyright
End Sub
StuartR
-
- 2StarLounger
- Posts: 107
- Joined: 23 Mar 2010, 13:42
Re: Closing SlideMaster, PowerPoint 2007
Feel free to call me names like "stupid, idiot etc " !!!!
The original Blank.potx file opens in SlideMaster, hence when my presentation creates it defaults to SlideMaster ..... what can I say, what a fool !!
Thanks for your help though.
Jack
The original Blank.potx file opens in SlideMaster, hence when my presentation creates it defaults to SlideMaster ..... what can I say, what a fool !!
Thanks for your help though.
Jack
-
- Administrator
- Posts: 78241
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Closing SlideMaster, PowerPoint 2007
Things like that happen to all of us! Thanks for letting us know.
Best wishes,
Hans
Hans
-
- Administrator
- Posts: 12577
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: Closing SlideMaster, PowerPoint 2007
Mistakes like this are too easy to make for any of us to dare call you names. The important thing is that you keep investigating till you realise what is happening.Jack21 wrote:Feel free to call me names...
Thanks for letting us know the outcome.
StuartR