ich habe ein eine Grafik die aus Excel per Makro in Word (Seite im Querformat) exportiert wird, auf das nächste Blatt wird (Seite im Hochformat) die zugehörige Tabelle exportiert.
Ich hätte das alles allerdings gerne als PDF ist s möglich das gleich als PDF zu machen oder automatisch von Word in ein PDF zu speichern, das das PDF gleich aufpoppt?
Viele Grüße,
Zoe
Sub CPChart()
Dim wkb As Workbook
Dim wordApp As Object
Dim WordObj As Object
Dim WordDoc As Object
Set wkb = ActiveWorkbook
Sheets("export_file").Unprotect ("abcde")
Sheets("export_file").ChartObjects("EMA_Auswertung").Activate
ActiveChart.ChartArea.Select
ActiveChart.ChartArea.Copy
Set wordApp = CreateObject("word.application")
With wordApp
.Visible = True
.Documents.Add
.ActiveDocument.PageSetup.Orientation = 1
.Selection.Paste
'Größe des eingefügten Diagramm-Bildes anpassen
With .ActiveDocument.InlineShapes(1) 'evtl. .Shapes(1)
.LockAspectRatio = msoTrue
.Width = Application.CentimetersToPoints(26) 'Breite = 26 cm
End With
'Absatzschaltung einfügen
.Selection.TypeParagraph
'Seitenumbruch einfügen
.Selection.InsertBreak Type:=3 '3 = dwSectionBreakContinuous
.Selection.PageSetup.Orientation = 0
'Excel-Zellbereich kopieren und in Word als Tabelle einfügen
wkb.Worksheets("export_file").Range(Worksheets("export_file").Cells(1, 30), _
Worksheets("export_file").Cells(Worksheets("export_file").Range("AB2").Value + 2, Worksheets("export_file").Range("AA3").Value + 32)).Copy
.Selection.PasteSpecial Link:=True
Application.CutCopyMode = False
Set WordObj = Nothing
Set WordDoc = Nothing
End With
Sheets("export_file").Protect ("abcde")
End Sub