I have a PowerPoint macro that takes pictures and adds them to an open slideshow. When I try to run the macro after clicking on the bottom of the list on the left side of the screen (which causes a solid blinking horizontal strip under the previous slide), I get an error:
Runtime error '-2147188160 (80042240)': Unknown member size: To select a size invalid request, its view must be active I thought This was because I got a valid o I did not have the object, so I added the defined debug statement for selection:
if ActiveWindow.Selection.Type = 0 then the MsgBox "0" end if if ActiveWindow.Selection.Type = 1 then the MsgBox "1 "End if ActiveWindow.Selection.Type = 2 then MsgBox" 2 "end if if active window. Selection. Type = 3 then the MSBbox "3" end if causes 1 to display the first picture to be added and the picture is properly added but Then shows the error and prevents the macro. Annoying, when I try to run it in debug mode, it works every time. I can only assume that I am manually fixing the problem in the accident when I debug it. The statement that causes this problem:
ActiveWindow.Selection.SlideRange.Shapes.AddPicture (// file information //). Select the line after ActiveWindow. Selection.ShapeRange.ZOrder msoSendToBack
I think I know what's happening here Used to be. If you / the user click on the slide thumbnail in the thumbnail panel, then the active choice may be the slide instead of the added image.
You can round it by doing something like this:
Om oSh = active window as a shape set. Selection. Slide rays Shape. Add image (// file information / /) OSh.ZOrder msoSendToBack Instead of working with one selection, one of the reasons for using object references (OAS in this case) ; -)
No comments:
Post a Comment