Problem with macro code and deleting/replacing images

bobson1869

New Member
Joined
Jun 16, 2017
Messages
2
Hello, I could really use some assistance in deleting images in my worksheet and replacing them with another image file, same size image. New to VBA and macros.



The macro stopped working after my computer was converted to microsoft office 365. It worked perfectly before.

The macro would enable two option buttons to be clicked, one for english, one for french. English was the default selection, but when french was selected, the macro would delete the logos on the page and replace them with their french alternatives. Now, instead of doing the aforementioned, the macro deletes some of the option buttons from the page (The english and french option buttons disappear), borders from some of the cells, and other unrelated option buttons on the worksheet.



Here is the code used to change the logo from one img file to another.



Code:
Code:
Sub changelogo()
Dim picPath, isopath As String
Dim Picture, isologo As Object
Dim leftie As Integer
 
 
If Sheets("SHEET 1").Range("A1") = 1 Then
picPath = "P:\LOGO\LOGO ENGLISH.png"
isopath = "P:\LOGO\LOGO2_English.jpg"
leftie = 19
ElseIf Sheets("SHEET 1").Range("a1") = 2 Then
picPath = "P:\LOGO\LOGO FRANCAIS.png"
isopath = "P:\LOGO\LOGO 2_Francais.jpg"
leftie = 18.5
End If
 
ActiveSheet.Pictures.Delete
ActiveSheet.Pictures.Insert(picPath).Select
 
Set Picture = Selection
Picture.Height = 56
Picture.Top = 88
Picture.Left = 394
 
ActiveSheet.Pictures.Insert(isopath).Select
 
Set Picture = Selection
Picture.Height = 90
Picture.Top = 764
Picture.Left = leftie
'Picture.Width = 160
'set cell height to picture size
'Picture.Top = Picture.TopLeftCell.Top
'Picture.Left = Picture.TopLeftCell.Left
'Picture.TopLeftCell.EntireRow.RowHeight = Picture.Height
 

End Sub


Any advice would really help me out
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

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