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 in Module 1
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:#
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:
I just can’t seem to figure it out. Any help would be greatly appreciated.#
Thanks for reading
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