Wil Moosa
Well-known Member
- Joined
- Aug 11, 2002
- Messages
- 893
While the code worked for a few days perfectly well it suddenly stopped at the line:
I also ran an early version of the workbook and there too the error occurs. Is this a memory thing or so? The full code is:
VBA Code:
Set oChrtO = oWs.ChartObjects.Add(Left:=0, Top:=0, Width:=lWidth, Height:=lHeight)
I also ran an early version of the workbook and there too the error occurs. Is this a memory thing or so? The full code is:
VBA Code:
[
Sub ExportDiagrammenFT()
Dim rng As Range
Dim oWs As Worksheet
Dim oRng As Range
Dim oChrtO As ChartObject
Dim lWidth As Long, lHeight As Long
On Error Resume Next
Set oWs = ActiveSheet
Set oRng = Worksheets("Grafieken_FT").Range("C1:O79")
On Error GoTo 0
If Not rng Is Nothing Then
rng.Select
End If
oRng.CopyPicture xlScreen, xlPicture
lWidth = oRng.Width
lHeight = oRng.Height
Set oChrtO = oWs.ChartObjects.Add(Left:=0, Top:=0, Width:=lWidth, Height:=lHeight)
oChrtO.Activate
With oChrtO.Chart
.Paste
.Export Filename:="C:\Test\Functiemix VH " & _
Format(Date, "dd-mm-yyyy") & ".jpg", Filtername:="jpg"
End With
oChrtO.Delete
Range("A1").Select
MsgBox "Een schermafdruk met de actuele diagrammen functie- en niveaumix is opgeslagen in de map 'historie'."
End Sub
/CODE]