Changing size of images pasted to email body in Outlook 2016
-
Changing size of images pasted to email body in Outlook 2016
This is a something that was always a nagging problem but got worse when I found a solution as it only worked for about 2 times then quit.
I have to use a screen capture utility (currently Lightscreen) to capture specific images on my screen and when I paste the results of the capture into the body of an email it is always too large by exactly double. This is regardless of the size of the screen area captured.
After pasting, I have to select the image click on picture settings and reduce the size by 50% on every one of them to get things to the proper perspective when emailed. This takes several clicks to do and in searching i found others with the same issue. I also found one person that posted a 'fix' using a custom VBA for Outlook.
The VBA was originally written to reduce by 75% but it worked perfect at 50% as well. One click of the macro would reduce all images in the email to 50% scale regardless of how many were there. Perfect! It worked for about 3 times, Just enough for me to be pleased i had a solution...Then suddenly it didn't.
It no longer works on the system it started on nor will it work on another system i tried it on. At this point I am beginning to suspect something to do with VBA in Outlook 2016. I even created a self-signed cert for it and signed the VBA module but at this point, even if i remove everything and try starting from scratch, i cannot get it to work again.
Below is the exported .bas file from Outlook if anything sticks out.
Or if anyone can suggest another way to achieve the same results? This is used to send screenshots of specific situations to people by email so it is almost always the same steps. I might find the answer in a different screen-capture utility but at this point I sure wish I knew why the VBA stopped working regardless.
Below is the code for the Macro to reduce by images 50%. This macro is then added to the QAT bar.
Code:
Attribute VB_Name = "Module1"Sub ResizeAllPicsTo50Pct() Const wdInlineShapePicture = 3 Dim olkMsg As Outlook.MailItem, wrdDoc As Object, wrdShp As Object Set olkMsg = Application.ActiveInspector.CurrentItem Set wrdDoc = olkMsg.GetInspector.WordEditor For Each wrdShp In wrdDoc.InlineShapes If wrdShp.Type = wdInlineShapePicture Then wrdShp.ScaleHeight = 50 wrdShp.ScaleWidth = 50 End If Next Set olkMsg = Nothing Set wrdDoc = Nothing Set wrdShp = NothingEnd Sub
-
-
What happens when you run the VBA? Is there an error message or similar?
Given the context... perhaps you could post a screenshot. (Ideally NOT reduced to 50%!)
I tried it quickly in Outlook 2016 and it seems to work for me.
-
What happens when you run the VBA? Is there an error message or similar?
Given the context... perhaps you could post a screenshot.
(Ideally NOT reduced to 50%!)
I tried it quickly in Outlook 2016 and it seems to work for me.
I agree I did for me as well. Did you use a self signed certificate? Or just disable Macro checks or? On further reading of the original post i found others who also had problems. Some reported back that it started working again but failed to say if they had done anything do fix it. At this point, i am just relieved to know someone else has it working as it is a perfect solution for my needs.
if you have manged to close Outlook and then reopen it and find it still working then i have to assume it is something about my copy of Outlook, maybe a different add-in or other program.
PS: I am not at the office where the original systems is but i can load it here and try it on this one and if I get results will post them
There are no errors, it just doesn't do anything all when selected. If i posted an image it might or might nort need reduction, Most of the ones that do are if pasted in to WORD or OUTLOOK and it is pretty obvious that they are larger than they are in real-life is the reason for the needed reduction.
-
-
I agree I did for me as well. Did you use a self signed certificate? Or just disable Macro checks or? On further reading of the original post i found others who also had problems. Some reported back that it started working again but failed to say if they had done anything do fix it. At this point, i am just relieved to know someone else has it working as it is a perfect solution for my needs.
if you have manged to close Outlook and then reopen it and find it still working then i have to assume it is something about my copy of Outlook, maybe a different add-in or other program
I just opened Outlook and pasted in the code from your post (with some Carriage Returns to keep VBA happy) and tried it on a test email. I didn't change any settings, I think (can't remember what I did when setting up the laptop but pretty sure I've not changed much). I don't even know how to make a self-signed certificate I'm afraid.
It's possible I'm not running the latest Outlook 2016 though.
What happens when you try it?
Edit: saw your PS. I'd probably open the VBA editor, ideally position Windows so you can see both the VBA Editor and the email window, and run the macro in 'Step Into' mode to see what happens step-by-step. Might give you a clue.
-
I just opened Outlook and pasted in the code from your post (with some Carriage Returns to keep VBA happy) and tried it on a test email. I didn't change any settings, I think (can't remember what I did when setting up the laptop but pretty sure I've not changed much). I don't even know how to make a self-signed certificate I'm afraid.
It's possible I'm not running the latest Outlook 2016 though.?
Give me a few secs to load it here. the self signed signature thing uses an app in outlook located at C:\Program Files (x86)\Microsoft Office\root\Office16 named "selfcert.exe". you can run that to create your own personal signing certificate using any name you want.
Then you can use this to sign VBA's or other modules as needed.
In the
this is what happens copy paste direct into the panel here >> Looks Pretty small.
This is where you set the Macro Security option in Trust Center Looks small now i will see what happens when i click post.
The answer is it enlarges perfectly so you can see what I mean
-
I see what you mean about adding line feeds it didn't look that way when i posted it Sorry
-
so far so good. Created macro, added to QAT. open new email added pic from clipboard, clicked button in QAT and it worked as advertised. On this system i have Macros enabled fully have not done any self signing etc. Just keeping track. I have also not restarted outlook to see if it saves the macro as enabled
here is the correct coding for anyne else if they should want it with the line feeds intact :)
"Sub ResizeAllPicsTo50Pct() Const wdInlineShapePicture = 3
Dim olkMsg As Outlook.MailItem, wrdDoc As Object, wrdShp As Object
Set olkMsg = Application.ActiveInspector.CurrentItem
Set wrdDoc = olkMsg.GetInspector.WordEditor
For Each wrdShp In wrdDoc.InlineShapes
If wrdShp.Type = wdInlineShapePicture Then
wrdShp.ScaleHeight = 50
wrdShp.ScaleWidth = 50
End If
Next
Set olkMsg = Nothing
Set wrdDoc = Nothing
Set wrdShp = Nothing
End Sub
"
I give up i pasted it direct from notepad inside the code block and it removed line feeds again so here is text.
OK i marked it solved because i guess the problem is local to those systems.
i did the close and reopen on outlook On closing it asked if i wanted to save the maacro. I said "Yes" as before.
On reopening Outlook the Macro option is stil in QAT and works properly. I may need to investigate the systems it failed on because it works fine here. Thanks much for your input giving me enough Hope to try it again here.
the obvious settings of 50 in height and width are where anyone else wanting this can change it as needed to whatever percent of scale they might need.
-
Once I tried saving the macro, closing and re-opening Outlook, it fails for me too!
It isn't behaving as it should, because even when I set the Macro security to Notify me, it just does nothing, when it should pop up a dialog or similar.
-
-
I just realized that if i mark it solved so one else can contribute so i changed it back to unsolved in case of other replies and in case i learn further of the reasons. In the various comments above where it may sound confusing: to clarify
If i paste an image into my post while writing it is extremely small but as soon as I click Post. the image shows at full size on the Board.
Also: when pasting into the CODE tags I don't know why the line feeds are dropped but it also dropped them the 2nd time so I added to statements inside regular quotes as text,
Finally, once the Macro is created, it cn easily be added to the Ribbon by selecting Customize the Ribbon with right click and choosing Macros from the list as shown here:
Again, this shows as very tiny while writing this but shows as full size once i click Post Quick Reply
-
Added info. The normal ALT+F8 keyboard press brings up the list of macros to run box and allows a keyboard shortcut access. What I would now like to find is the way to make a dedicated keyboard shortcut to RUN the command when pressed.
DavidY: on the problem: Once I tried saving the macro, closing and re-opening Outlook, it fails for me too!
I am pretty sure that if you go to the setting under File>Options>Trust Center> Trust Center Settings
to get the image I first posted above. In that area under Macro Settings choose enable for ALL (at least as a test).
Click OK and back all the way out then close Outlook.
On the exit from Outlook be sure to Save the Macro when it asks.
Finally, it probably wouldn't hurt to sign out of Windows then back in (faster than rebooting) so you can be 100% sure nothing was held over. I have done all of this trying my best to get it to Fail now .. :) So far.. So good!
That is pretty much where I am now and after several restarts I am comfortable that the Macro is staying on-board and working.
PPS: see this link This is where i ended up on the other systems looing for a reason for the same behavior you got. Same issues. No errors no verbiage as to what is wrong.
https://social.msdn.microsoft.com/Fo...rum=outlookdev