Senso
Inventaris
- Lid geworden
- 13 jun 2016
- Berichten
- 10.590
- Besturingssysteem
- W10 Pro en W11 Pro
- Office versie
- Office 2007 H@S en Office 2021 Prof Plus
Ik heb onderstaande code gevonden. Lijkt mij handig maar moet geschikt zijn voor meerdere documenten. Waar plaats ik de module? Ik heb twee pc's.
PHP:
Sub CopyRangeToJpeg()
Dim aChart As Chart, Rng As Range, Path As String
Path = CreateObject("WScript.Shell").SpecialFolders("Desktop") & "\" & "Capture.jpg"
'Set Rng = Sheets("TABLE").Range("C2:G57")
Set Rng = Range("X1:AI37")
Call Rng.CopyPicture(xlScreen, xlPicture)
With Sheets.Add
.Shapes.AddChart
.Activate
.Shapes.Item(1).Select
Set aChart = ActiveChart
.Shapes.Item(1).Line.Visible = msoFalse
.Shapes.Item(1).Width = Rng.Width
.Shapes.Item(1).Height = Rng.Height
aChart.Paste
aChart.Export (Path)
Application.DisplayAlerts = False
.Delete
Application.DisplayAlerts = True
End With
MsgBox "Saved to " & vbCr & Path, vbInformation, ""
End Sub