Combox/Group level changing VBA problem!

Pyromantic

Board Regular
Joined
Aug 9, 2006
Messages
58
Hi again! I’m having a few problems with a little of code. I have a combox dropdown from which an individual can select a number of companies, An event in the worksheet then checks the company which has been selected and formats the sheet according. The code for this looks as follows:

Code in the worksheet
Code:
 Private Sub ComboBox3_Change()
    Application.ScreenUpdating = False
    If Range("C3").Value = 20240 Then CPL
    If Range("C3").Value = 20241 Then CPL
    If Range("C3").Value = 20247 Then JWR
    Application.ScreenUpdating = True
End Sub

Code in Module 1
Code:
 Sub JWR()
    ActiveSheet.Shapes("LOGO").Delete
    Range("D19:E20").Select
    ActiveSheet.Pictures.Insert("http://www.ajilon.co.uk/graphics/logos/jonathanwren.gif").Select
    With Selection
        .ShapeRange.IncrementLeft 40.25
        .ShapeRange.IncrementTop -0.75
        .Name = "LOGO"
    End With
    Range("D26:R26,D35:R35,D42:R42,D57:R57").Interior.ColorIndex = 10
    Range("D44:R44,D59:R59").Interior.ColorIndex = 15
    Range("D19:E20").Select
End Sub
Sub CPL()
    ActiveSheet.Shapes("LOGO").Delete
    Range("D19:E20").Select
    ActiveSheet.Pictures.Insert("http://www.ajilon.co.uk/graphics/logos/computerpeople.gif").Select
    With Selection
        .ShapeRange.IncrementLeft 40.25
        .ShapeRange.IncrementTop 0.75
        .Name = "LOGO"
    End With
    Range("D26:R26,D35:R35,D42:R42,D57:R57").Interior.ColorIndex = 5
    Range("D44:R44,D59:R59").Interior.ColorIndex = 6
    Range("D19:E20").Select
End Sub

Now the problem I have is when I click a button which I have created to change the grouping levels on the spreadsheet. The code for the button is as follows:#

Code:
 Private Sub Group_button_Click()
    ActiveSheet.Outline.ShowLevels RowLevels:=1
End Sub

At this point the debugger pops up stating:

Runtime error ‘1004’

Unable to get insert property of picture class.


And apparently according to the debugger, this is the guilty piece of code:

Code:
 ActiveSheet.Pictures.Insert("http://www.ajilon.co.uk/graphics/logos/computerpeople.gif").Select

I just can’t seem to figure it out. Any help would be greatly appreciated.#

Thanks for reading
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Forum statistics

Threads
1,136,878
Messages
5,678,302
Members
419,753
Latest member
Sallylwy

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
Top