Skip to main content
davidd92744211
Known Participant
August 12, 2020
Question

ResizeImage in VBA not Working Correctly After Latest Update

  • August 12, 2020
  • 2 replies
  • 826 views

Hi there,

 

I have a VBA script that I've been uses for ages. It does a couple of things including resizing the open image in pixels with the value entered by the user.

 

Ever since I updated to the latest 2020 version, the ResizeImage Method in VBA takes the value entered by the user and resizes the image in centremetres, not pixels. I have never had to set the Preferences.TypeUnit to pixels in the script but I did to ensure that wasn't the issue making it resize in centremetres. Still to no avail.

 

So at this stage I'm stuck as it looks like a bug. I cannot get it to resize in pixels at all.

 

Any help would be appreciated.

This topic has been closed for replies.

2 replies

davidd92744211
Known Participant
August 14, 2020

Bump*

JJMack
Community Expert
Community Expert
August 14, 2020

Do not depent on the user ruler setting. Save their setting,  set ruler units to pixels, do your resize. Restore the  user ruler units.

JJMack
davidd92744211
Known Participant
August 14, 2020

JJMack, you are a legend!

 

Setting the RulerUnits to 1 (pixels) fixed the issue.

 

Just a note for others, changing the TypeUnits to pixels (1) didn't help.

 

I end up with this:

appRef.Preferences.RulerUnits = 1

 

Where of course appRef is:

Set appRef = CreateObject("Photoshop.Application")

 

Thanks JJMack! 

JJMack
Community Expert
Community Expert
August 12, 2020

Does you script set ruler units to pixels or relies on the users current preference.

JJMack
davidd92744211
Known Participant
August 12, 2020

Thanks JJMack for the reply.

 

The script does not set the ruler units but relies on the current user preference.