Hi,
Ich würde gerne ein Bild von meinem Arbeitsblatt(nur bestimmter Bereich) erstellen und dieses in einem Ordner speichern.
Grundsätzlich funktioniert der Code, aber nicht bei der gewünschten Tabelle.
Bei der Zeile:
".PasteSpecial Format:="
Bitmap
", Link:=False, DisplayAsIcon:=False"
komme ich nicht weiter...
Welchen Befehl hab ich vergessen? Fehlercode wenn ich den
Error
-Befehl entferne: Laufzeitfehler
Bei jeder anderen Tabelle funktioniert es... Sind aber alle gleich aufgebaut?
LG Manuel
Code:
Dim
objPict
As
Object
, objChrt
As
Chart
Dim
rngImage
As
Range, strFile
As
String
On
Error
GoTo
ErrExit
With
Tabelle8
Set
rngImage = .Range(
"A1:L50"
)
rngImage.CopyPicture Appearance:=xlScreen, Format:=xlBitmap
!!!!!!! .PasteSpecial Format:=
"Bitmap"
, Link:=
False
, DisplayAsIcon:=
False
!!!!!!!
Set
objPict = .Shapes(.Shapes.Count)
strFile = ActiveWorkbook.path &
"\ARBEITSBERICHTE\Vorschau.gif"
objPict.Copy
Set
objChrt = .ChartObjects.Add(1, 1, objPict.Width + 8, objPict.Height + 8).Chart
objChrt.ChartArea.
Select
objChrt.Paste
objChrt.Export strFile
objChrt.Parent.Delete
objPict.Delete
End
With
ErrExit:
Set
objPict =
Nothing
Set
objChrt =
Nothing
Set
rngImage =
Nothing