iyi günler aşağıdaki kodlar ile yapılan baskı önizleme sıkça kullandığım bir yöntem.Ve de güzel çalışıyordu.Ama zaman zaman
Run-Time error'1004":
Method'Export' of object'_Chart'failed hatası veriyor.Bu hata ne anlama geliyor,yardımcı olacaklara çok teşekkür ederim.
Private Sub UserForm_Initialize()
Call GetSh("kantin")
'Frame1.Caption=anasayfa.ComboBox1.Value&" TAŞIMA LİSTESİ"
End Sub
Private Sub GetSh(ShName As String)
Dim objTemp As Object
Dim chtMyChart As Chart
Dim rngImg As Range
Dim NoD As Long
NoD = Sheets(ShName).Range("a65536").Cells.End(xlUp).Row
Set rngImg = Sheets(ShName).Range("A1:c" & NoD)
rngImg.Copy
Set objTemp = ActiveSheet.Shapes.AddShape(1, 1, 1, 1, 1)
objTemp.Select
ActiveSheet.Paste
objTemp.Delete
With Selection
.CopyPicture 1, 2
Set chtMyChart = ActiveSheet.ChartObjects.Add(1, 1, .Width, .Height).Chart
With chtMyChart
.Paste
.Export "kantin.jpg"
.Parent.Delete
End With
.Delete
End With
With Frame1
.Picture = LoadPicture("kantin.jpg")
.PictureSizeMode = fmPictureSizeModeClip
End With
Kill "kantin.jpg"
Set rngImg = Nothing
Set objTemp = Nothing
End Sub
Run-Time error'1004":
Method'Export' of object'_Chart'failed hatası veriyor.Bu hata ne anlama geliyor,yardımcı olacaklara çok teşekkür ederim.
Private Sub UserForm_Initialize()
Call GetSh("kantin")
'Frame1.Caption=anasayfa.ComboBox1.Value&" TAŞIMA LİSTESİ"
End Sub
Private Sub GetSh(ShName As String)
Dim objTemp As Object
Dim chtMyChart As Chart
Dim rngImg As Range
Dim NoD As Long
NoD = Sheets(ShName).Range("a65536").Cells.End(xlUp).Row
Set rngImg = Sheets(ShName).Range("A1:c" & NoD)
rngImg.Copy
Set objTemp = ActiveSheet.Shapes.AddShape(1, 1, 1, 1, 1)
objTemp.Select
ActiveSheet.Paste
objTemp.Delete
With Selection
.CopyPicture 1, 2
Set chtMyChart = ActiveSheet.ChartObjects.Add(1, 1, .Width, .Height).Chart
With chtMyChart
.Paste
.Export "kantin.jpg"
.Parent.Delete
End With
.Delete
End With
With Frame1
.Picture = LoadPicture("kantin.jpg")
.PictureSizeMode = fmPictureSizeModeClip
End With
Kill "kantin.jpg"
Set rngImg = Nothing
Set objTemp = Nothing
End Sub