Objekterstellung durch activex nicht mög
30.06.2020 10:06:34
MarC
ich habe ein mega Problem. Ich erhalte immer die Meldung "Objekterstellung durch Activex-Komponenten nicht möglich". Ich kann damit leider wenig anfangen und es auch nicht nachvollziehen. Kann mir bitte jemand helfen ich bin echt ratlos.
Option Explicit
Sub PDF()
Dim KPIRow As Long
Dim TKPIRow As Long
Dim appWord As Object
Dim docVorlage As Object
Dim WBTRows As Long
Dim WBTRows2 As Long
Dim BQLZeile As Long
Dim BQLSpalte As Long
Set appWord = CreateObject("Word.Application")
Set docVorlage = appWord.Documents.Add("https://xxxxxxxxxxx/Shared Documents/Vorlagen/Template - _
Handover.docx")
Application.ScreenUpdating = False
docVorlage.Tables(1).Cell(1, 2).Range = Sheets("Tabelle3").Range("B9")
Sheets("Tabelle2").Activate
With Worksheets("Tabelle2")
For KPIRow = 6 To Cells(Rows.Count, 2).End(xlUp).Row
If (.Cells(KPIRow, 2)) = "Shipping" Then
docVorlage.Tables(5).Cell(3, 2).Range = Sheets("Tabelle2").Cells(KPIRow + 3, 13) _
End If
Next KPIRow
End With
WBTRows2 = Sheets("Tabelle1").Range("A8").End(xlDown).Row
WBTRows2 = WBTRows2 - 8
With docVorlage.Tables(10)
For WBTRows = 1 To WBTRows2
docVorlage.Tables.Item(10).Rows.Add (docVorlage.Tables(10).Cell(WBTRows + 3, 1). _
Range)
Next WBTRows
End With
With Sheets("Tabelle1")
For BQLZeile = 1 To WBTRows2
For BQLSpalte = 2 To 9
.Cells(BQLZeile + 7, BQLSpalte).Copy
docVorlage.Tables(10).Cell(BQLZeile + 2, BQLSpalte - 1).Range.Paste
Next BQLSpalte
Next BQLZeile
End With
docVorlage.ExportAsFixedFormat OutputFileName:="C:\Users\" & Environ("Username") & "\ _
Desktop\" & "Handover" & Format(Now, "yyyy.mm.dd_hhmm") & ".pdf", ExportFormat:=17
Set docVorlage = Nothing
Set appWord = Nothing
appWord.Close
Sheets("Tabelle3").Activate
End Sub