Can I navigate a WebBrowser control to embedded image inside Excel file? - vba

I have an .xlsm file with an ActiveX Microsoft Web Browser control ("Shell.Explorer.2").
I use VBA to open an image inside of it:
WebBrowser.Navigate Application.ActiveWorkbook.Path & "\image.gif"
I know that if I put an image on the worksheet it will be saved inside the .xlsm file. Such images are stored in the .xlsm (which is of ZIP structure) at \xl\media\ 'folder'.
Now I'd like to move the image from the workbook's path into the .xlsm file itself. How can I then address this image from the WebBrowser control? Should I navigate to a file inside of .xlsm as to resource or could I refer to a shape holding the image?
I know about solution based on copying (or exporting) the image from the shape and creating a dynamic HTML to include this newly copied image. I'd still like to find a way without copying/exporting it.
Thanks!

Related

Extract Images from Word Doc or ScreenShot and Save as JPG

I need to save a screenshot to an independent .jpg file, in the MS Word environment.
I can't save to a chart and export the chart (chart function not available in Word, only Excel).
I can't save as HTML and go into the created directory (only creates PNG files and can't use).
I can't use any function that utilizes Option Explicit (this messes other variables in my userforms).
It would be awesome if I could copy the "save as picture" function when right clicking an image in a word document in a VBA Macro.

How to bundle my own images and call from function

I have built several custom add-ins for Powerpoint. I integrated them into PPT using Custom UI Editor for Office.
As part of this process, I could make my own icons for buttons, simply by 'Inserting' my own .png files into the PPT (presumably somewhere in the backend, if I were to unbundle the .zip. file which every PPT actually is.
Now, I want to create a button that allows users to easily insert country flag icons, which I can obtain in .svg format. How can I bundle these .svg or .png files into PPT, and call them from a module?
(I don't think it's the calling from module I have trouble with - I just don't know how to bundle the image files into the PPT.)
[EDIT] Alternatively, what I'm asking is this: How can I create an 'Insert Icons' interface that looks like what you get from Insert >> Icons?
(update: John Korchok's answer has made clear this is not possible)
[EDIT2] If you rename your powerpoint from .pptm to .zip```, you can see a folder inside the Zip file called ```ppt. Inside it, you get these folders:
Inside the media folder are EMF and WMF files created from pictures that were inserted into PPT (through the normal Insert Image function, or a simple Copy and Paste).
Is there a way I can write a function that calls images from within this folder?
There's no part of an Add-in where you might be able to store external files. I add a folder of images in the Add-ins folder, then create an installer that places the Add-in and folder in the correct locations.
You can also place the images on a web server and get PowerPoint to download them through VBA. Of course, you'll need a fast connection. The syntax looks like this:
Dim oPicture As Shape
Set oPicture = ActivePresentation.Slides(1).Shapes.AddPicture("http://www.brandwares.com/images/iconfile.png", False, True, 0, 0, -1, -1)

Extract an Outlook attachment from the clipboard

I'm trying to access Outlook attachments from clipboard using VBA to further process the file.
The user copies an attachment to the clipboard (Right click -> Copy), opens PowerPoint, clicks a buttons and gets the presentation inserted a the end of the document.
The key part seems to access the PowerPoint file in the clipboard an save it on the file system.
Can someone help and provide a sample code for this using VBA in PowerPoint?
Many thanks!
I've found a way achieve it.
Getting filenames: Solution has been posted here: http://www.access-o-mania.de/forum/index.php?topic=17045.15
Getting the content
file size in clipboard can be obtained by GlobalSize(handle)
pointer the by GlobalLock(handle)
content using CopyMemory(destination, source, length)
Look at the clipboard contents with an app like ClipSpy. Since there is no physical file to be copied, the full file path is not included (no CF_HDROP format). But FileGroupDescriptor and FileContents formats are there.

PowerPoint 2007 - Save images to a file?

I was sent some PowerPoint 2007 files with approximately 75 slides in each. On each slide is one photo. I need to extract the photo from each slide to save in a folder on my system. How can it be achieved?
If for some reason you NEED to do the job using VBA, follow the link David's provided.
If it's a one-shot need to extract the images, make a copy of the PPTX file to begin with.
Let's call it COPY.PPTX for purposes of argument.
Rename COPY.PPTX to COPY.ZIP or even COPY.PPTX.ZIP
Now open the zip file, browse to the media folder and there you'll find the images in the file. Drag them out to wherever you want to store them and you're done.
For Each Slide in ActivePresentation.Slides
Slide.Shapes(1).Export FileName:="folderPath\imageName.jpg" _
Filter:=ppShapeFormatJPG
Next Slide

How do I hyperlink from a PDF file to a specific page in a PPT file

I have a PowerPoint 2010 file saved as a PowerPoint Macro-enabled show (.ppsm) file. I have a hyperlink on a particular page of the PPSM and I've linked it to a PDF file. Great, it all works.
Now I need to put a hyperlink in the PDF file that will jump me back to the specific page in the PPSM, but I can't seem to figure out how to do it. The information in another thread says to add "#15" (the page number) to the filename, but the link seems to put the entire file path. I also get an error that this is not a valid file name. I want to be able to just store the files together in the same directory and have them find each other with the file name, not the whole path.
All assistance gratefully accepted.
If you're running the slide show and link to a PDF file, the show is still running and sitting on the slide you linked from.
All you need to add to the PDF is a link that closes the PDF or possibly quits Acrobat/Reader altogether.
Open the PDF in Acrobat, add a link, choose Custom Link, click Next.
In Link Properties dialog box, go to the Actions tab
Select Action: Execute a menu item.
Click Add to get a list of available menu items, choose File, Close
or File, Exit.
If you need to return to some other page than the one you started on in PPT, it gets a bit trickier.