hello,
iīve a very big Problem to view a diagram in a userform. i get always the error runtime error 481 invalid Picture and i didnīt find any solution.
maybe you can help me.
Iīve a userform and a makro
here is the makro code
when i click on the degugg button the following code will be Show in yellow
UserForm8.Image1.Picture = LoadPicture(dateiname)
Sub Bild_Anzeigen(strTab As String, strDia As String)
ActiveSheet.Unprotect Password:="test"
Dim Diagramm As Object
Dim dblBreite As Double
Dim dblHoehe As Double
Set Diagramm = Worksheets(strTab).ChartObjects(strDia).Chart
With Diagramm.Parent
dblHoehe = .Height
dblBreite = .Width
.Height = dblHoehe
.Width = dblBreite
Dateiname = ThisWorkbook.Path & Application.PathSeparator & "diagramm.bmp"
End With
Diagramm.Export Filename:=Dateiname, FilterName:="bmp"
With UserForm8
.Image1.Width = Diagramm.Parent.Width
.Image1.Height = Diagramm.Parent.Height
.Width = .Image1.Width + 15
.Height = .Image1.Height + 30
End With
UserForm8.Image1.Picture = LoadPicture(Dateiname)
With Diagramm.Parent
.Height = Diagramm.Parent.Height
.Width = Diagramm.Parent.Width
End With
Kill Dateiname
UserForm8.Show
ActiveSheet.Protect Password:="test", DrawingObjects:=False, Contents:=True, Scenarios:= _
True, AllowFiltering:=True
End Sub
Moderator Note:
Pls use code tags around your code next time as per forum rules.
Bookmarks