Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
1500to1504
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

Von Excel in Word -> als PDF speichern mit VBA?

Von Excel in Word -> als PDF speichern mit VBA?
06.07.2016 08:16:23
Zoe
Hallo,
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

1
Beitrag zum Forumthread
Beitrag zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Von Excel in Word -> als PDF speichern mit VBA?
06.07.2016 09:01:26
JoWE
Hallo Zoe,
so z.B.
.ActiveDocument.ExportAsFixedFormat Outputfilename:="DeinDateiname.pdf", _
ExportFormat:=wdExportFormatPDF, OpenAfterExport:=True, _
OptimizeFor:=wdExportOptimizeForPrint, Range:= _
wdExportAllDocument, Item:=wdExportDocumentContent, _
IncludeDocProps:=True, KeepIRM:=True, CreateBookmarks:= _
wdExportCreateNoBookmarks, DocStructureTags:=True, _
BitmapMissingFonts:=True, UseISO19005_1:=False
Gruß
Jochen
Anzeige

333 Forumthreads zu ähnlichen Themen

Anzeige
Anzeige
Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige