Link to home
Start Free TrialLog in
Avatar of Ainsley Rood
Ainsley Rood

asked on

Embeded Images

Hi, Please Please help, I'm stuck and frustrated by what must be a simple thing to overcome! I thought Mr Google has the answer to everything, but today he's falling short!

I'm nearly finished creating a workbook for a customer which contains lots of VBA and a couple of input/update forms. To make the forms look nicer I added their company logo within an image component on said forms. During development I added a basic load image statement in the form initialisation event: imgLogo.Picture = LoadPicture("T:\STORES\Logo.jpg"). Works great, however, I don't want to impose that they need to have this image file is any specific path on the file system. I was hoping I can embed the image in the workbook itself and somehow reference it from within.
Avatar of Ramin
Ramin

I'm not sure if this helps,
Right-click the form and select Properties, then look for the Picture property
https://support.office.com/en-us/article/Add-or-remove-a-sheet-background-3577a762-8450-4556-96a2-cc265abc00a8?ui=en-US&rs=en-US&ad=US&fromAR=1
Avatar of Ainsley Rood

ASKER

Thanks Ramin, Appreciate the help - Unfortunately, the image needs to be used within a VBA Form rather than a worksheet. As you don't seem to be able to apply an image to an image control at design time it's not shipped within the workbook. Thank you
Instead of Loading picture from any path in your VBA, try to Insert Logo in UserForm
Thanks Shums, sounds interesting. The only thing available on my toolbox / insert menus is an image control. When you say to insert a logo, how would I go about that? Is that a different object from an image / If so, to I need to add additional references or use "more controls"?
1. Click insert image in UserFrom
2. In property window of that UserFrom, click on Picture, where it will ask you the location of image, select the image
3. In property window of that UserFrom, PictureSizeMode: select 1-fmPictureSizeModeScretch. Adjust the size as per logo.
User generated imageHope this helps
Kindly note, the logo should be in bmp format
User generated image
Looks great.... so you can assign an image during design time then! My Picture Property has the "..." button, however, when clicked does nothings (which is why I loaded one on initialization).
What happens when you click those "..."
Once you embed image in userform, you don't need to add in initialize.
Check this link where it explains both ways of loading image to userform and assigning with path.

Hope this helps.
Hi All,

Shums has managed to take my workbook, set an picture to my image control and return it to me... and I can see the picture in design time. Problem is, I cant change it / set it... The "..." button appears to do nothing.

The Image control is:
Microsoft Forms 2.0 Image

And my IDE states:
MS Visual Basic for Applications 7.1
Version: 1056
VBA: Retail 7.1.1056
Forms3: 16.0.7571.7095
ASKER CERTIFIED SOLUTION
Avatar of Shums Faruk
Shums Faruk
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Great Stuff, thanks for all your help. I'm sure there must be an IDE bug, but copy and paste formed a great workaround. Really Appreciated. Thanks