Hi all, Nick 97 just helped with this.
I have a spreadsheet with operations perfomed by VBA code on several userforms. I have code that allows a user to select a picture and place it on a user form as image1. The code works properly and users can navigate to a graphic file, select the file and the image is placed on the userfom. With help from Nick97, now each time the userform is initialised the graphic shows on the userform.
Thank works OK while the file is opened on my computer. Can I embed the graphic on the userform so if the file is opened on another computer, (it wont have the correct graphic or file path) the graphic will show on the userform on the new computer.
current routines are:
Private Sub CommandButton2_Click()
Dim openDialog As Office.FileDialog
Dim FName As String
Set openDialog = Application.FileDialog(msoFileDialogFilePicker)
openDialog.Filters.Add "JPEG Files", "*.jpg"
.AllowMultiSelect = False
.ButtonName = "Submit"
.Title = "Select an image file"
.Filters.Add "Image", "*.gif; *.jpg; *.jpeg", 1
If .Show = -1 Then
Me.Image1.PictureSizeMode = fmPictureSizeModeZoom
Me.Image1.Picture = LoadPicture(.SelectedItems(1))
FName = openDialog.SelectedItems(1)
Sheets("SoftwareParameters").Range("LogoGraphic") = FName
Private Sub userForm_Initialize()
Me.Image1.Picture = LoadPicture(Sheets("SoftwareParameters").Range("LogoGraphic"))