I would like to copy Picture in Cell not sheet?

Venterpj1

New Member
Joined
Jun 18, 2016
Messages
7
I'm pretty new to Macros and userforms
I would like to add a picture in a cell (That is loaded from a userform), if possibly re size it so all the pictures are more or less (In Kb) the same size and that they also look uniform (In the cells / Range)
Then also save an original copy of the picture in a folder so I can reference / call back the original picture in full quality, on a later stage.

This is what i have so far:

Private Sub CommandButton4_Click()
Dim fileToOpen As Variant
Sheets("Backup").Select
fileToOpen = Application _
.GetOpenFilename("All Picture Files (*.jpg;*.gif;*.bmp;*.tif),*.jpg;*.gif;*.bmp;*.tif")
If fileToOpen <> False Then
Me.Image1.Picture = LoadPicture(fileToOpen)
Image1.PictureSizeMode = fmPictureSizeModeStretch
Me.Repaint
Image1.Visible = True
Set pic = ActiveSheet.Shapes.AddPicture(Filename:=fileToOpen, _
LinkToFile:=msoFalse, SaveWithDocument:=msoCTrue, Left:=0, Top:=0, Width:=-1, Height:=-1)
End If
End Sub




Any assistance will be greatly appriciated
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Code:
[COLOR=#333333]Private Sub CommandButton4_Click()[/COLOR]
[COLOR=#333333]Dim fileToOpen As Variant[/COLOR]
[COLOR=#333333]Sheets("Backup").Select[/COLOR]
[COLOR=#333333]fileToOpen = Application _[/COLOR]
[COLOR=#333333].GetOpenFilename("All Picture Files (*.jpg;*.gif;*.bmp;*.tif),*.jpg;*.gif;*.bmp;*.tif")[/COLOR]
[COLOR=#333333]If fileToOpen <> False Then[/COLOR]
[COLOR=#333333]Me.Image1.Picture = LoadPicture(fileToOpen)[/COLOR]
[COLOR=#333333]Image1.PictureSizeMode = fmPictureSizeModeStretch[/COLOR]
[COLOR=#333333]Me.Repaint[/COLOR]
[COLOR=#333333]Image1.Visible = True[/COLOR]
[COLOR=#333333]Set pic = ActiveSheet.Shapes.AddPicture(Filename:=fileToOpen, _[/COLOR]
[COLOR=#333333]LinkToFile:=msoFalse, SaveWithDocument:=msoCTrue, Left:=0, Top:=0, Width:=-1, Height:=-1)[/COLOR]
[COLOR=#333333]End If[/COLOR]
[COLOR=#333333]End Sub[/COLOR]
 
Upvote 0

Forum statistics

Threads
1,215,706
Messages
6,126,334
Members
449,309
Latest member
kevinsucher

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top