Hi
On below line i am getting error
Picture1.FormattedPicture = Nothing
Private Sub Section3_Format(ByVal pFormattingInfo As Object)
Picture1.FormattedPicture = Nothing
Set Picture1.FormattedPicture = LoadPicture(cimage1.Value)
End Sub
Thanks
Muhammad Imran AnsariPosted Apr 17, 2025, 6:30 PM
Hello Ramco,
You're getting an error here, probably because:
FormattedPicturemay not support assignment toNothing.Or you're using
= NothingwhereSetshould be used (in older VB versions).If You're Using VB6 / Classic VBA:
If You're Using VB.NET:
You should not use
Set, and you can't set.FormattedPicturetoNothingif it's not allowed. You may want to skip setting it toNothingentirely if it's causing an error.Good Luck!
Rajeesh MenothPosted Apr 17, 2025, 8:36 AM
You should clearly specify the type of error you are encountering, whether it is related to a null object or something else. Otherwise, it is very difficult to suggest an answer.
Sophia CarterPosted Apr 16, 2025, 10:49 AM
Hi there! It seems like you're dealing with an Invalid Use of Property issue in your code snippet. The error you're encountering on the line "Picture1.FormattedPicture = Nothing" may be due to the property "FormattedPicture" not supporting the assignment of "Nothing" as a valid value.
In VBA, certain properties do not allow direct assignment of "Nothing" to clear them out. Instead, you can usually set the property to a default or empty value depending on the type of property it is.
If you are trying to clear the "FormattedPicture" property of Picture1, you might need to use a different approach. For instance, if "FormattedPicture" is a picture object, you may set it to a blank image or a default picture instead of directly assigning "Nothing".
Here is an example of how you could modify your code:
By adjusting how you handle the assignment to the "FormattedPicture" property, you can potentially avoid the Invalid Use of Property error. If you are unsure about what values are acceptable for the property or how to clear it properly, it could be beneficial to refer to the documentation specific to the Picture control or seek further assistance.
I hope this sheds some light on your issue. Feel free to let me know if you need more guidance or have any other questions!