Good afternoon!
I am working on an Excel template, which is going to be provided to a large group that is being asked to take pictures of properties, attach them to a spreadsheet, and send them back. I am using the following code to get the pictures (there are 5), and paste them in the correct area of the page - based on size, not a cell reference. How can I write code to have these pictures retrieved and pasted into an "upload" table to that will be uploaded to the database? Do I need to reference a cell when pasting the pictures, and then reference that same cell when grabbing them? Not sure where to go from here - any help would be appreciated!
Sub ChangeImage1()
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.ButtonName = "Submit"
.Title = "Select an image file"
.Filters.Clear
.Filters.Add "JPG", "*.JPG"
.Filters.Add "JPEG File Interchange Format", "*.JPEG"
.Filters.Add "Graphics Interchange Format", "*.GIF"
.Filters.Add "Portable Network Graphics", "*.PNG"
.Filters.Add "Tag Image File Format", "*.TIFF"
.Filters.Add "All Pictures", "*.*"
If .Show = -1 Then
Dim img As Object
Set img = ActiveSheet.Pictures.Insert(.SelectedItems(1))
'Scale image size
'img.ShapeRange.ScaleWidth 0.75, msoFalse, msoScaleFromTopLeft
'img.ShapeRange.ScaleHeight 0.75, msoFalse, msoScaleFromTopLeft
'Position Image
img.Left = 0
img.Top = 1780
'Set image sizes in points (72 point per inch)
img.Width = 650
img.Height = 465
Else
MsgBox ("Cancelled.")
End If
End With
End Sub
I am working on an Excel template, which is going to be provided to a large group that is being asked to take pictures of properties, attach them to a spreadsheet, and send them back. I am using the following code to get the pictures (there are 5), and paste them in the correct area of the page - based on size, not a cell reference. How can I write code to have these pictures retrieved and pasted into an "upload" table to that will be uploaded to the database? Do I need to reference a cell when pasting the pictures, and then reference that same cell when grabbing them? Not sure where to go from here - any help would be appreciated!
Sub ChangeImage1()
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.ButtonName = "Submit"
.Title = "Select an image file"
.Filters.Clear
.Filters.Add "JPG", "*.JPG"
.Filters.Add "JPEG File Interchange Format", "*.JPEG"
.Filters.Add "Graphics Interchange Format", "*.GIF"
.Filters.Add "Portable Network Graphics", "*.PNG"
.Filters.Add "Tag Image File Format", "*.TIFF"
.Filters.Add "All Pictures", "*.*"
If .Show = -1 Then
Dim img As Object
Set img = ActiveSheet.Pictures.Insert(.SelectedItems(1))
'Scale image size
'img.ShapeRange.ScaleWidth 0.75, msoFalse, msoScaleFromTopLeft
'img.ShapeRange.ScaleHeight 0.75, msoFalse, msoScaleFromTopLeft
'Position Image
img.Left = 0
img.Top = 1780
'Set image sizes in points (72 point per inch)
img.Width = 650
img.Height = 465
Else
MsgBox ("Cancelled.")
End If
End With
End Sub