Hi
Error - Object does not support this property or method on this line
lOldWidth = img.ScaleWidth \ Screen.TwipsPerPixelX
Dim img As StdPicture
Set img = LoadPicture("c:\image.jpg")
Dim lSourceX As Long, lSourceY As Long
Dim lOldWidth As Long, lOldHeight As Long
Dim lNewWidth As Long, lNewHeight As Long
lOldWidth = img.ScaleWidth \ Screen.TwipsPerPixelX
Thanks
Daniel WrightPosted Mar 20, 2025, 10:25 AM
It seems like the error "Object does not support this property or method" is occurring due to the line of code:
This error typically indicates that the `ScaleWidth` property is not supported by the `img` object. The `ScaleWidth` property is commonly used with certain types of objects like controls or forms but may not be available for the `StdPicture` object you are working with.
To address this issue, you might need to reconsider how you are trying to retrieve the width of the image loaded using `LoadPicture`. One way to get the dimensions of the image could be by accessing the `Width` and `Height` properties of the `img` object directly. Here's an example of how you could modify your code:
By directly accessing the `Width` and `Height` properties of the `img` object, you can retrieve the dimensions of the image without relying on the `ScaleWidth` property, which might not be supported in this context.
I hope this helps clarify the issue you are facing. Feel free to ask if you have any more questions or need further assistance!