Probleme mit einem VBA-Script
14.08.2004 11:46:44
Ingo
Ich nutze Windows XP Professional SP1
und Excel 2002 XP.
Gestern musste ich aufgrund eines Problems mit meinem Rechner
die Windows Reparatur-Funktion der Windows Installations CD nutzen.
Und nun will eines meiner Excel VBA-Scripte nicht mehr so ganz richtig funktionieren.
Ich poste hier mal den entsprechenden Abschnitt:
---------------------------------------------------------------
Dim PDF_Pfad As String
Dim AppWord As Object
PDF_Pfad = "D:\SPACEart\Bilder-Rename\__PDF.doc"
Set AppWord = CreateObject("Word.Application")
Dim Text1 As String: Text1 = Worksheets(1).Range("C" & ActiveCell.Row).Value
Dim Text2 As String: Text2 = Worksheets(1).Range("H" & ActiveCell.Row).Value
Dim Text3 As String: Text3 = Worksheets(1).Range("D" & ActiveCell.Row).Value
Dim Text4 As String: Text4 = Worksheets(1).Range("E" & ActiveCell.Row).Value
Dim Text5 As String: Text5 = Worksheets(1).Range("B" & ActiveCell.Row).Value
Dim Text6 As String: Text6 = Worksheets(1).Range("F" & ActiveCell.Row).Value
Dim Text7 As String: Text7 = Worksheets(1).Range("X" & ActiveCell.Row).Value
With AppWord
.Documents.Add
.Selection.Font.Name = "Arial"
.Selection.Font.Bold = True
.Selection.Font.Size = 9
.Selection.TypeText Text1
.Selection.TypeParagraph
.Selection.Font.Bold = False
.Selection.TypeText Text2 & ", " & Text3 & ", " & Text4
.Selection.TypeParagraph
.Selection.TypeText "Bestell-Nr : " & Text5 & " " & Text6 & ",- "
.Selection.TypeParagraph
.Selection.TypeParagraph
.Selection.Font.Size = 8
.Selection.TypeText Text7
.Selection.ParagraphFormat.Alignment = 3
.ActiveDocument.SaveAs Filename:=PDF_Pfad
.Quit
End With
Set AppWord = Nothing
---------------------------------------------------------------
Beim Ausführen erhalte ich der Zeile:
Set AppWord = CreateObject("Word.Application")
eine Fehlermeldung.
Da ich selber leider keine große Ahnung von VBA habe,
würde ich mich wirklich riesig freuen,
wenn mir von Euch jemand helfen könnte :)
Gruß
Ingo