I there, following the instructions here : VBA insert picture as fill
But I can't change the image.
First, let me say what I need. I have a sheet with a table with the location of some images, on this format: C:\Users\MyName\Google Drive\Invoices\IMG_20200911_181558.jpg
I want to go for all image, like a command button "Next" and "Previous". And for that I have a image to show the current image select. I already have this code, but not working, because don't change the picture:
The sub change_image was made by @Worf. So If I put another link on cell J53 like: C:\Users\MyName\Google Drive\Invoices\IMG_test.jpg, the imagem don't change.
If someone has another solution to make this work, please let me know, for now I need help on this..
I tryed Image Object and used LoadPicture but the application got so laggy! So slow!
Thank you in advance.
But I can't change the image.
First, let me say what I need. I have a sheet with a table with the location of some images, on this format: C:\Users\MyName\Google Drive\Invoices\IMG_20200911_181558.jpg
I want to go for all image, like a command button "Next" and "Previous". And for that I have a image to show the current image select. I already have this code, but not working, because don't change the picture:
VBA Code:
Option Explicit
Sub new_image()
Dim ws As Worksheet
Dim imagePath As String
Dim imgLeft As Double
Dim imgTop As Double
Dim shp As Object
Set ws = ActiveSheet
imagePath = "C:\Users\MyName\Google Drive\Invoices\IMG_20200911_181558.jpg"
imgLeft = ActiveCell.Left
imgTop = ActiveCell.Top
Set shp = ws.Shapes.AddPicture(imagePath, msoFalse, msoTrue, imgLeft, imgTop, -1, -1)
shp.Name = "img_invoices"
End Sub
Sub change_image()
With ActiveSheet.Shapes("img_invoices").Fill
.Visible = msoTrue
.UserPicture CStr([j53]) ' cell J53
.TextureTile = msoFalse
.RotateWithObject = msoTrue
End With
End Sub
The sub change_image was made by @Worf. So If I put another link on cell J53 like: C:\Users\MyName\Google Drive\Invoices\IMG_test.jpg, the imagem don't change.
If someone has another solution to make this work, please let me know, for now I need help on this..
I tryed Image Object and used LoadPicture but the application got so laggy! So slow!
Thank you in advance.