sunilhaokha
New Member
- Joined
- Aug 10, 2020
- Messages
- 10
- Office Version
- 2016
- Platform
- Windows
Well, I was trying to load picture in an Image Control with a button click through a Dialog Box for selection of the image file that i wanted to. Here is the codes.
Private Sub CommandButton1_Click()
Dim filePath As String
Dim fileInt As Integer
Application.FileDialog(msoFileDialogOpen).AllowMultiSelect = False
fileInt = Application.FileDialog(msoFileDialogOpen).Show
If fileInt <> 0 Then
filePath = Application.FileDialog(msoFileDialogOpen).SelectedItems(1)
Me.Image1.Picture = LoadPicture(filePath) ' I found the error type here
Me.Image1.PictureSizeMode = fmPictureSizeModeStretch
End If
End Sub
And also, please help me to pass the selected image file into a Cell Range with Auto-Adjustment according to the range.
Private Sub CommandButton1_Click()
Dim filePath As String
Dim fileInt As Integer
Application.FileDialog(msoFileDialogOpen).AllowMultiSelect = False
fileInt = Application.FileDialog(msoFileDialogOpen).Show
If fileInt <> 0 Then
filePath = Application.FileDialog(msoFileDialogOpen).SelectedItems(1)
Me.Image1.Picture = LoadPicture(filePath) ' I found the error type here
Me.Image1.PictureSizeMode = fmPictureSizeModeStretch
End If
End Sub
And also, please help me to pass the selected image file into a Cell Range with Auto-Adjustment according to the range.