0
Ich wollte die Bilder auf dem Word-Dokument auf lokales Laufwerk exportieren, wie kann ich es von Excel mit VBA tun.So exportieren Sie Bilder von Word-Dokument auf lokales Laufwerk
Sub gen_Files()
Dim WdApp As Word.Application, Doc As Word.Document, fPath As String
Dim i As Long
fPath = ThisWorkbook.Path & Application.PathSeparator & "Test.docx"
If fPath = "" Or Dir(fPath) = "" Then MsgBox "Invalid file path.": Exit Sub
Set WdApp = New Word.Application
WdApp.Visible = True
Set Doc = WdApp.Documents.Open(fPath)
Doc.SaveAs2 ThisWorkbook.Path & "\New.docx", FileFormat:=12
For i = 1 To Doc.InlineShapes.Count
'Doc.InlineShapes(i).Range.ExportAsFixedFormat(ThisWorkbook.Path & Application.PathSeparator & i & ".jpg",wdExportFormatXPS,False,,,,,,,,,,)
Next i
'Save the file and done
Doc.Save
Doc.Close
WdApp.Quit
End Sub
Dank hat es das Bild exportieren, aber alle waren leere weiße Bilder – Rohan
@Rohan: In meinen Tests gut funktioniert. –