asked on
Private Sub CommandButton2_Click()
Dim openDialog As Office.FileDialog
Dim FName As String
Set openDialog = Application.FileDialog(msoFileDialogFilePicker)
openDialog.Filters.Clear
openDialog.Filters.Add "JPEG Files", "*.jpg"
With Application.FileDialog(msoFileDialogFilePicker)
.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))
Me.Repaint
FName = openDialog.SelectedItems(1)
Sheets("SoftwareParameters").Range("LogoGraphic") = FName
Else
End If
End With
End Sub
Private Sub userForm_Initialize()
Me.Image1.Picture = LoadPicture(Sheets("SoftwareParameters").Range("LogoGraphic"))
End Sub
ASKER
ASKER
Private Sub CommandButton2_Click()
Dim openDialog As Office.FileDialog
Dim SheetName As String
Set openDialog = Application.FileDialog(msoFileDialogFilePicker)
openDialog.Filters.Clear
openDialog.Filters.Add "JPEG Files", "*.jpg"
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.ButtonName = "Submit"
.Title = "Select an image file"
.Filters.Add "Image", "*.gif; *.jpg; *.jpeg", 1
If .Show = -1 Then
'add a sheet
Worksheets.Add
ActiveSheet.Pictures.Insert(.SelectedItems(1)).Select
ActiveSheet.Shapes(1).CopyPicture xlScreen, xlBitmap
SheetName = ActiveSheet.Name
Application.DisplayAlerts = False
Worksheets(SheetName).Delete
Application.DisplayAlerts = True
'Paste the picture from the clipboard into our image control
Me.Image1.Picture = PastePicture(xlBitmap)
Me.Repaint
Else
End If
End With
End Sub
ASKER
ASKER
Microsoft Excel topics include formulas, formatting, VBA macros and user-defined functions, and everything else related to the spreadsheet user interface, including error messages.
TRUSTED BY
What you CAN do is take .SelectedItems(1) and use that to save the desired file to a desired network location.
Then the image will work across all the computers on the network.
Do you need help to work out the nuts and bolts of that?
Or do you want to wait and see if someone knows if you can embed the image?