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:
Any advice would really help me out
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