I am getting really frustrated. I have code that works, as in it literally does what it says it will do, however, it doesn't always correctly read my images on the slides as images. I even went so far as naming them all "Picture" and using it as a variable. It actually worked for a second but then 5 pictures in it stopped working again.
This is the code and it DOES work:
With shp.Fill.PictureEffects
Dim eff As PictureEffect
Set eff = .Insert(msoEffectSharpenSoften)
eff.EffectParameters(1).Value = 1
End With
Why will this block of code not work on all of my images? Even when it throws the error it WILL sharpen the image as intended, but then stop??? I do not understand the problem or what a possible fix might be. This is literally the last bit of my work process that I need to solve...
For the record, I have code that will adjust the Height, Width, and center the image perfectly on the slide with no issues whatsoever, code that will put images in a placeholder and then format text... but for some reason THIS block of code won't work...
I have also tried deleting the image, manually reuploading it using the Insert Picture function in the program and it still doesn't work??? Is it possible this has something to do with the fact I am using PowerPoint 2013?
I tested it a different way by changing the picture format, it seemed like it was working but it didn't. Whether I automate it, whether I insert picture, no matter what I do, whether it's in a pre positioned container or not, this line of code refuses to work. Why are my images, in both PNG and JPEG format not being accepted by PowerPoint VBA?
Related
I have a greyscale image with some transparent sections too. I would like to recolour this within excel (based on the value that a user types in a cell or something)
Manually, all I need to do is select the picture then in the ribbon 🡒 format 🡒 colour 🡒 more variations 🡒 more colours and select appropriately. I've tried the macro recorder on these steps but get nothing useful.
Searching the web has led me to believe that the Shape.PictureFormat.Recolor method, which I'm guessing is what I want, is only availible in Publisher. I'd rather not interface with thatfor portability reasons (in case publisher isn't installed), and I'd also like this to run as speedily as possible.
I've even considered converting the image to an array of bytes, performing the required pixel manipulations then converting back to an image, but I think that'll be slow. I also don't have a clue how.
Is there a method in VBA to recolour an image in this way, leaving alpha as it is? Perhaps with the use of an ActiveX image control? Here's an example image in case it's not clear
White 🡒 Green
Black 🡒 Black
Alpha 🡒 Alpha
If you can't find a pure object model based solution, you can try to modify the document xml. It is not the easiest of solutions, but it is far easier than pixel manipulation.
Do like this:
Save your workbook without modification
Do the color change
Save the file again, with a different file name
Unzip the two *.xlsx files you created
Analyze the differences. You'll most likely find it in the drawings folder
Recreate the changes in the xml of the second file in the first one and zip it back together. If that works, you now have a theoretical way to the solution.
If you get this to work, you can automate these steps.
There is a beautiful script producing a rectangle with rounded corners here:
http://gnuplot-surprising.blogspot.de/2011/10/round-corner-rectangle-in-gnuplot.html
It works so far and I'm able to adapt this example to my needs.
The problem is that it does not work properly in case of pdf output and I have no idea why .. there seems to be a problem with pdf and filledcurve in a way, that the area is not properly filled. Viewing the pdf you can clearly see that the filling consists of stripes and in between them are white lines separating them. It looks really bad on screen and on paper.
Again: the problem only occurs if the script is adapted to pdf output!
I've been working on this all day and still no clue how to fix this.
Does anyone see a way out? Or is it an inherent problem of the way curves are filled?
I am writing a Word 2007 document with a lot of images that are sure to change before the document is delivered. Therefore, I am inserting them in the document as links to PNG files. My problem is that if I select the image and execute:
Selection.InlineShapes(1).LinkFormat.Update
MsgBox Selection.InlineShapes(1).LinkFormat is Nothing
the message box displays "True". That is, the Update method broke the link.
I have tried using Selection.InlineShapes(1).Delete, followed by Selection.InlineShapes.AddPicture. This updates the image, but now I need to crop the image and that introduces its own set of problems. Before trying to deal with the cropping issues, I'm hoping that someone has a better way of updating the linked file.
BTW, closing the document and reopening it updates the image nicely as long as the filename has not changed. The point of the macro is to cope with filename changes, if necessary.
What I am ultimately trying to do is to create a grid of images for print that are minor variations of the same thing (different text is all). Looking through online resources I was able to create a script that changes the text and exports all of the images necessary (several hundred). What I am trying to do now is to import all of these images into a new photoshop document and lay them all out in a grid and I can't seem to find any examples of this.
Can anyone point me in the right direction to place a file at a specific coordinate (I'm using CS5 and have the design suite so if there is a way in illustrator to do this quickly...)?
Also, I'm open to other ideas on how to do this (even other programs) easily. It's for labels so the positioning on the sheet has to be pretty precise...
The art layer object has a translate() method that takes delta x and y params. You'll need to open each image, copy it to the target document, get its current location (using artLayer.bounds) and do the math to find the deltas to position it where you want it. Your deltas can be in pixels so you'll get plenty of precision.
Check out your 'JavaScript Scripting Reference' pdf in your Adobe install directory for more details.
Ok I'm marking Anna's response as the answer because though I didn't fully test it, it seems like it should work and answers the original question with jsx. However I'm also leaving my final solution in case anyone else runs across this with the same issue and may prefer this method as well.
What I ended up doing instead is using InDesign. I figured out that it has a grid option that lets you import a number of files and place them all in an equal grid in a single command. This is almost exactly what I was looking for, except that it leaves a small border/margin in between the columns and grids and mine were designed to meet exactly.
I couldn't figure out how to make it not have the border (I have very little experience with InDesign, it may be possible). However I was able to select all my images and scale them uniformly to be the correct size, then I just selected each column and dragged it over to snap to the adjacent column and the same with rows...
I'm creating a program to generate PDF files in VB.Net.
Everything is working fine except that the image is being displayed with a blue background while the image provided doesn't have any.
Following are the lines of code being used:
sColor = IIf(mvarEncodeASCII85, ToASCII85(ImgColor),
(System.Text.Encoding.GetEncoding(1252).GetString(ImgColor)))
What am I doing wrong?
There is not alot of details, but my first thougt is that it is .png-files or .gif-files.
Am I correct? In that case it may be an issue with adobe acrobat handling the transparent backgrounds.
As I said it's hard to say exactly without any further details.