I am trying to set PowerPoint normal view with the code below. The code shows the normal slide, but the left-side thumbnails do not show up in a left-side pane.
wapp.ActiveWindow.ViewType = PpViewType.ppViewNormal;
I have looked through all the ppViewType options, but none of them produce the desired results.
Does someone know the magic syntax (VBA or C#) to make the normal display look like the display when I click the Normal button on the UI? Thank you.
I get the thumbnails showing if I run 2 view statements. The first sets the view to ppViewSlide (without thumbnails). Then ppViewNormal restores the thumbnails:
Sub ShowHideWindows()
With ActiveWindow
.ViewType = ppViewSlide
.ViewType = ppViewNormal
End With
End Sub
Related
I've got a MS Access form that contains a subreport.
This is to allow a sort of dynamic preview of what you are going to get when you launch the print (in fact it's a form that allows to chose among different print layouts).
Let's say that my report is this:
It has also non-fixed fields, but it's not relevant for this issue.
The report is quite small and when presented in the form I would like to apply some sort of zoom, which actually I can't find.
Even if the subform/subreport control is much larger than the report, there seems not to exist a property that allows you to resize the report.
The result is this:
I tried setting Default View to Print Preview, no changes in visualization.
I hoped that switching to Print Preview would allow a greater control of the zoom (like actually happens when you launch a 'standard' print preview).
I tried setting FitToPage to true.
I tried to set AllowReportView to force the Print Preview, with no luck. At this point i think Print Preview is simply not allowed in a report inside a form.
Is there some (or some other) way to address this smallness problem?
Thanks in advance
P.S. If zooming is not possible, I would at least highlight the real report area because showing only the borders of the subform/subreport control would be confusing in this case.
Correct, report on form can only be displayed in ReportView. I don't think you can get 'zoom' feature by any method. As for 'highlight' of report area, code could set Backcolor property of each report section when report loads, like:
Private Sub Report_Load()
With Me
If .CurrentView = 6 Then
.ReportHeader.BackColor = vbYellow
.ReportFooter.BackColor = vbYellow
.PageHeaderSection.BackColor = vbYellow
.PageFooterSection.BackColor = vbYellow
.GroupHeader0.BackColor = vbYellow
.GroupFooter1.BackColor = vbYellow
.Detail.BackColor = vbYellow
End If
End With
End Sub
Might want to set all controls with transparent BackStyle.
Or instead of setting Backcolor, use a background image (watermark) on report.
I'm trying to have several slides with tables, each table has 3 columns, the last column is the "reference value" and I want it to be hidden during the presentation and show it only by pressing a button or a hyperlink, each row individually. I think it's possible because I'm really new at coding and I have managed to do it by changing the cell's text format from white (which is the table's background color) to red, but I can only do it for all the tables at once, and I need individual values on each one of them. (I hope I'm making myself clear). This is what I have done so far:
Sub format()
Dim s As Slide
Dim oSh As Shape
Dim oTbl As Table
For Each s In ActivePresentation.Slides
For Each oSh In s.Shapes
If oSh.HasTable Then
Set oTbl = oSh.Table
With oTbl.Cell(2, 3).Shape.TextFrame.TextRange
.Text = "4500-9000"
.Font.Size = 12
.Font.Color = vbRed
End With
End If
Next
Next s
End Sub
But this will change the same cell on every table I have, I want it to change specific cells in specific tables one by one, since they all have different valued. I know I could do this with animations, but I'd rather do it this way.
EDIT: It would be great if, instead of pressing a button, I could get the data by hovering the pointer over the empty cell, and have it hidden away again when I hover the cursor off the cell.
In any case, whenever I do any change to the presentation during slideshow, the change will still be there at the end, which means It would only work once and then I would have to fix and hide all the values again, is there a way to restore the changes done during the presentation when it ends?
you could adpt your sub and call it from another procedure by passing a reference to the table and cell you want to process like this:
Sub FormatTableCell(oTbl As Shape, lRow As Long, lCol As Long)
With oTbl.Cell(lRow, lCol).Shape.TextFrame.TextRange
.Text = "4500-9000"
.Font.Size = 12
.Font.Color = vbRed
End With
End Sub
For example:
With ActivePresentation
FormatTableCell .Slides(1).Shapes("MyTable"), lRow:=1, lCol:=1
End With
Regarding the triggers for hover over and hover out, this is a tricky aspect of PowerPoint. There IS a trigger to run code when hovering over a shape but there is NOT a trigger for hovering out of a shape. To achieve the latter, you could put a transparent rectangle in the back layer of your slide and use that to spoof the hover out trigger by linking a hover over macro to it. Write your code and use the Insert / Action / Mouse Over function to trigger your VBA procedure with a signature like this:
Public Sub FormatThisTable(oTbl As Shape)
Note that this method only passes the shape (a table in your case) and not the cell the mouse is hovering over. The only way I can see you could achieve that would be to use a lot of very complex Windows APIs to detect the mouse cursor position relative to the table's on-screen coordinates.
Alternative approaches could either be to ungroup the table to a set of separate shapes or create cover shapes for each cell you need to show/hide and manage their visibility properties using the mouse in/out technique above.
For the last point, you will need to use application level events which requires code in a class module and this a good article to show you how:
http://www.pptfaq.com/FAQ00004_Make_your_VBA_code_in_PowerPoint_respond_to_events.htm
Step 1
Launch PowerPoint and open the PPTX file that contains the rows you want to hide. Click the appropriate slide in the Slides pane to the left of the screen.
Step 2
Double-click the spreadsheet on the slide, which will allow you to edit it. Select the rows that you want to hide. Click the “Home” tab and locate the “Cells” section. Click the “Format” option, which will display a list of available features.
Step 3
Place the pointer over the “Hide & Unhide” listing in the “Visibility” section. Click the “Hide Rows” option to hide the selected rows. Click outside the spreadsheet to return to the PowerPoint slide.
ActiveWindow.ViewType = ppViewThumbnails
Above code run to following error message:
"DocumentWindow (unknown member) : Invalid enumeration value."
Help please
Your question is rather very brief...to justify as a question to give a fair answer. However looking at your error message (thank Goodness it's there) here is what you can check:
When you try to programmatically view the thumbnails of a Microsoft PowerPoint presentation, you may receive a run-time error message that you have gotten. This behavior occurs because PowerPoint is not designed to let you view the thumbnails in the entire active window. Thumbnails can be viewed only in the Thumbnail pane to the left of the slide pane. The lines of code described in the "Symptoms" section attempt to display the thumbnails in the entire active window.
Workaround is given in the above kb article. Please follow that and let us know if you get stuck still:
To work around this issue, you need to test to find out which pane is active, and then activate the Thumbnail pane.
Instead of assuming your view is ppthumnails, try to validate it first using the following IF:
With ActiveWindow
If .ActivePane.ViewType <> ppViewThumbnails Then
.Panes(1).Activate
.ViewType = ppViewThumbnails
CheckView = True
Else
CheckView = False
End If
End With
Try:
ActiveWindow.ViewType = ppViewSlide
ActiveWindow.ViewType = ppViewNormal
It seems that PPT doesn't support 'ppViewThumbnails' view type because thumbnails cannot cover the entire ActiveWindow.
Workaround: First set the view type to 'slide only' and then to 'normal view' which recovers the thumbnail view mode.
I have a word doc with a bunch of ActiveX Control buttons or whatever on it, and each time a button is clicked, a corresponding image needs to be displayed in a popup box.
I have a userform called ImageForm, and this is what I'm doing right now:
Sub Button_Clicked()
ImageForm.Picture = LoadPicture("appropriate_image_path")
ImageForm.Show
End Sub
Each of these images has a width of 8.5 inches, but their heights can vary anywhere from like 3 to 20 inches (they're snippets of a pdf). So I've set the width of the userform to a little more than 8.5 inches, and that looks fine. But I need to be able to scroll vertically through the image in the userform, since some of the images could be taller than a user's monitor.
I'm completely stuck on this. What I've tried so far is adding a frame to the form, then adding an image control inside the form, and setting the "ScrollBars" property of the frame to vertical. Then instead of using "ImageForm.Picture = ..." I use "ImageForm.ImageControl.Picture = ..." But it doesn't work.
Any insight here would be greatly appreciated. Hopefully this question is clear enough, I've only been using VBA for a month or so now. (I miss Java so, so much)
Thanks!
Here is a neat little trick based on one of my posts
The idea is to ensure that the image control is in frame control and the image control doesn't have a border. Also the image control's PictureSizeMode is set to fmPictureSizeModeClip so that we can scroll the image
SNAPSHOT (DESIGN TIME)
SNAPSHOT (RUN TIME)
CODE
Private Sub UserForm_Initialize()
With Frame1
'~~> This will create a vertical scrollbar
.ScrollBars = fmScrollBarsVertical
'~~> Change the values of 2 as Per your requirements
.ScrollHeight = .InsideHeight * 2
.ScrollWidth = .InsideWidth * 9
End With
With Image1
.Picture = LoadPicture("C:\Users\Public\Pictures\Sample Pictures\Desert.jpg")
.BorderStyle = fmBorderStyleNone
.PictureSizeMode = fmPictureSizeModeClip
End With
End Sub
Is it possible to use VBA to hide/show a text box on a Custom Layout in a PowerPoint 2010? I would like to hide/show a specific text box that is on the custom layout of each slide at the click of a button and am not sure of the best way to go about doing that.
Any help, much appreciated.
Suppose you have a shape named Rectangle 6 on the third layout of the first slide master.
Sub Example()
Dim oSh As Shape
' Get a reference to the shape
Set oSh = ActivePresentation.Designs(1).SlideMaster.CustomLayouts(3).Shapes("Rectangle 6")
' Set its visible property to false
oSh.Visible = False
End Sub
Generally, yes, though setting some shapes (title placeholder on the master, for example) won't necessarily make the title text on individual slides disappear. "Slide master" can mean different things in different PPT versions. Which are you targeting, and do you want to hide a shape on ALL masters/layouts in the presentation or just some?