Mahlzeit jungs,
Ich habe da mal ein Anliegen.
Zuerst der Hintergrund...
2 OfficeFiles. Ein doc ein xls.
Ich möchte nun das ich aus Delphi heraus
Seite 1-7 des doc drucke
dann das xls
und anschliessend Seite 8-12 des gleichen docs .
Ich habe ja schon mit der Serienbrieffunktion gespielt etc. Das war alles kein Thema.
Aber momentan kenn ich mich nicht mehr aus.
Ich habe folgendes gemacht, mir das Makro erstellt :
Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11:
| Sub Makro2() ' ' Makro2 Makro ' Makro aufgezeichnet am 10.10.2009 von skipper ' Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _ wdPrintDocumentContent, Copies:=1, Pages:="1-7;8-12", PageType:= _ wdPrintAllPages, ManualDuplexPrint:=False, Collate:=True, Background:= _ True, PrintToFile:=False, PrintZoomColumn:=0, PrintZoomRow:=0, _ PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0 End Sub |
- Das Makro gilt momentan für beide Seitenabschnitte ... kann man ja "trennen" nachher -
Anschließend bin ich hergegangen und habe das in meinen Code eingefriemelt,
was dann ja so aussehen sollte :
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113:
| procedure TForm4.Image12Click(Sender: TObject); var Word: OLEVariant; ExcelApp: OLEVariant; strPfad : string;
begin begin Word:=CreateOleObject('Word.Application'); strPfad := ExtractFilePath(ParamStr(0)); try Word.Visible:=false; Word.Documents.Open(strPfad + '.\geraetebuecher\GB_temp_' + uppercase(Edit1.Text) + '.doc');
Word.ActiveDocument.PrintOut( wdPrintRangeOfPages, wdPrintDocumentContent, 1, 1-7, wdPrintAllPages, False, True, True, False, 0, 0, 0, 0); Word.Documents.Close(False, EmptyParam, EmptyParam); finally if not VarIsEmpty(Word) then begin Word.Quit; Word := Unassigned; end; end; end;
delay(1500);
begin ExcelApp := CreateOleObject('Excel.Application'); strPfad := ExtractFilePath(ParamStr(0)); try ExcelApp.Workbooks.Open(strPfad + '.\geraetebuecher\' + uppercase(Edit1.Text) + '.xls');
ExcelApp.Worksheets.PrintOut; finally if not VarIsEmpty(ExcelApp) then begin ExcelApp.Quit; ExcelApp := Unassigned; end; end; end;
delay(1500);
begin
Word:=CreateOleObject('Word.Application'); strPfad := ExtractFilePath(ParamStr(0)); try Word.Visible:=false; Word.Documents.Open(strPfad + '.\geraetebuecher\GB_temp_' + uppercase(Edit1.Text) + '.doc');
Word.ActiveDocument.PrintOut( wdPrintRangeOfPages, wdPrintDocumentContent, 1, 8-12, wdPrintAllPages, False, True, True, False, 0, 0, 0, 0); Word.Documents.Close(False, EmptyParam, EmptyParam); finally if not VarIsEmpty(Word) then begin Word.Quit; Word := Unassigned; end; end; end; Image13.Visible := TRUE; end; |
Nun ja.
Bei allen noch erdenklichen Kombinationen, bekomme ich entweder nen OLESysError "Typkonflikt" oder ein gemecker das ein Parameter ausserhalb des zulaessigen wertes liegt.
o.0 also so langsam habe ich keinen Plan mehr wo es da hängt
Umgebung ist übrigens D6E und Office 2003 ENG mit 1031 MUI (Deu)
Danke schonmal für Tips und Anregungen