word-vba: Unable to update linked image link - vba

I have a document with two inlineshapes into a table on the document header. These inlineshapes are linked images. The folder containing these images has moved and I'm unable to change the image link by VBA code.
I'm working with Word 2016. The documents were created on Word 2003. The only way to access the images has been exploring the table cells and finding the inlineshapes into them
The inlineshapes have no field object defined (nothing)
I can update the link manually going into the File menu > Edit File Links...
I would like to be able to change the image links with vba and not having to do it manually

Well, at last I found what happened.
The images have to be accessed as inlineshapes, not as fields
the path to the image is stored in the property InlineShape.LinkFormat.SourceFullName
Changing this property value and then updating the inlineshape it worked
Sorry if I've bothered you but I think it can be helpful to other users

Related

Creating dynamic PDF internal links with BIRT

I am trying to create a PDF in BIRT and I need to have bookmarks linking from a summary page to each detail page. The links work fine in the HTML preview and a similar http link works in published PDFs. However, the internal links do not work in the PDF format.
What I have tried so far is setting the bookmark property to "detail_" + row["nodeid"] and setting the hyperlink to the same. As stated, this works for the HTML preview, but not the PDF export.
The PDF has automatically generated TOC items that I would prefer to leverage off, but I don't know how to link to those.
Is there a way that I can get the PDF output to contain the required links using either bookmark properties, or the generated TOC items?
Sample PDF output (Customer data removed, alternate locations selected)
The solution to the problem lies not in the format of the bookmark/hyperlink, but in the placement of the bookmark.
The problem was, I was placing the bookmark on the row of the table I wanted to link to. Instead, the bookmark needed to be on the label in the first column of the row.
I believe the issue is that, in the HTML version, the table row is a <tr> tag, however in the PDF, the row doesn't physically exist, so there's nothing to set the bookmark on. However the label/text item exists in both versions, so the bookmark is created correctly.

How do I save an image as resource in Excel and reference it in Footer?

I am trying to embed a logo in the footer of a dynamically generated spreadsheet.
My first thought was to see what "macro recorder" would provide. Unfortunately, it references an image on the user's computer. The problem is that, in most cases, this file will not exist, and I don't want the user to have to download an image for the VBA script to be functional.
Is it possible to store an image in a VBA-enabled spreadsheet as a resource and then reference it from the footer?

PowerPoint Add-in directly access its object

Powerpoint file is actually a zip file that contains xml sub-files. These sub-files illustrate all the properties of objects of every slides (e.g., position, color, animation, etc.). You can convert the pptx file into zip file and unzip it you will see sub xml files.
Now, I want to create a Powerpoint Add-in application, allowing me to add more information to a specific object, and store dynamically it in itself XML file (or when saving file as). For example, my Add-in PowerPoint application contains a button named "Flippable". When I select a specific object of a slide, and select "Flippable", my application will find the xml file that contains the object information, and add a tag "Flippable = true".
Is it possible to do that dynamically when running application?
Thanks
Why go to all the effort of cracking and parsing the XML file, assuming that you even can while he presentation's open in PPT, especially since you're already doing this from an add-in?
You mentioned that the user has selected a shape. Why not just tag the shape:
With ActiveWindow.Selection.ShapeRange(1)
.Tags.Add "Flippable", "Yes"
End With
You'd want a bit more code around that to make sure that there IS a selection, and if you want to allow tagging multiple shapes at one time, you'd need to put in inside a For Each/Next loop.
Then assuming a reference to the current shape to be tested in oSh
If oSh.Tags("Flippable")="Yes" Then
' Do your stuff
End If

Placing a bitmap into a Powerpoint Add-In

All:
I am writing a PowerPoint add-in that will allow a user to drop specific safety related images onto a map. I've written the code that copies the images and places them on the slide and I would like to place it into an add-in. Unfortunately, I cannot find a way to either:
a) place the images into the add-in
b) reference images if I were able to place them in the add-in
The alternative approach is to require the user to start with a special template that includes all of the images and then load the add-in to get the menu functionality. I would much rather have a single file that contains both the code and bitmap images.
With best regards,
Walt
PPA files contain only code, not presentation content like images. As an alternative, you could distribute a PPT/PPTX that you open invisibly and extract the image you need.
After quite a bit of looking around I found a solution that resolves the problem adequately. Using Microsoft's Custom UI Editor, I created an XML entry in the PowerPoint Presentation that performs the Auto_Open function that would have been part of the Add-In. This allows me to add the menu functions that will be responsible for loading the specific images.
I've added a reference page at the beginning of the presentation that contains instructions on how to use the template... This page also contains all of the images that are used by the visual basic code. The 'Visible' flag on these images are set to False so the user does not see them. As they are copied from the reference page into the presentation, the Visible flag is set to True and they are pasted onto the current slide.
It is not a perfect solution, but it is adequate...

How to save options of a VSTO add-in in the currently open file?

I'm building a VSTO add-in for Powerpoint 2010 and the options the add-in sets apply to the currently open file instead of a per-user config. Can I save these options in the current file (I mean, add custom XML to the .PPTX file)? If so, how?
Thanks for your help.
For very simple data, custom properties are ok (so long as you're aware that anyone who opens the file will be able to see, edit and delete them). And note that because PPT shares a common, too-small, allocation of data between links and document properties, adding too many of one can wipe out the other.
I'd use tags instead. Every shape, slide and presentation object can have a tags collection, containing one or more Name / Value pairs of strings.
These are invisible to the user and will not interfere with the hyperlinks in the presentation.
' To add a tag
With ActivePresentation
.Tags.Add "MyTagName", "MyTagValue"
End With
' To use a tag
If ActivePresentation.Tags("MyTagName") = "MyTagValue" Then
' Do something or other
End If
If your Options are not too complex, I would go for Document Custom Properties. The following question illustrates how to use Custom Properties with Excel, they are supported in PowerPoint as well so this should provide a good starting point!