简体   繁体   中英

PowerPoint - Shapes.AddOLEObject method adds the web browser control in black?

Please see the below link first,

Shapes.AddOLEObject method not working in PowerPoint 2013 (32bit and 64bit)?

Half the issue was solved there first. So, I am using the following code to add web browser control to PowerPoint slide,

Set oShp = oSld.Shapes.AddOLEObject(Left:=100, Top:=100, Width:=200, Height:=300, Classname:="Shell.Explorer", Link:=msoFalse)

The web browser control adds a PDF file.

The above code adds the OLEObject to the slide. But in PowerPoint 2010 the added shape is black as shown in below screen,

在此处输入图片说明

This is not the background color. It should be transparent like below image,

在此处输入图片说明

When I view the slide in Slide Mode (the PDF file is openned) and close it, the OLEObject (web browser control) becomes transparent (how it should be). In addition, in PowerPoint 2013 the OLEObject is added as shown below,

在此处输入图片说明

That little black square shows by red circle should not be there. This too when viewed in Slide Mode ; the OLEObject (web browser control) becomes transparent.

In PowerPoint 2007 there are no issues. When the OLEObject is added, it is transparent.

So how to avoid this black color from the OLEObject in PowerPoint 2010 and 2013? When the OLEObject is added it must not show the black color. I think it is because of the web browser control. What do I need to do here?

You must navigate the WebBrowser to something to have any control on what is shown. For instance, about:blank , a custom page of yours or an empty PDF. Otherwise, it's just an empty container.

Alternatively, if you don't need navigation, you could embed Acrobat Reader directly, but I think you'll get more or less the same behavior regarding black/white rectangles until you open a document.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM