Autor Beitrag
Conny Drexler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 44


D6 prof. win xp
BeitragVerfasst: Mo 05.11.12 18:59 
Ich bekomme beim Aufruf des Outlook Objektes die Fehlermeldung "Ungültige Klassenzeichenfole"
Was hat das zu bedeuten???

Ich hab hier mal den Code mit eingebunden wo der Fehler auftritt.

Danke für die Hilfe.

CDX

ausblenden volle Höhe Delphi-Quelltext
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:
unit umail;

interface

uses utypen,uconst,shellapi,comobj;

procedure mail(betreff:zeile;
               Mitteilung: string;
               Adresse:zeile;
               Dateianhang:string);

const umail_const = '1.03/120615';

implementation

procedure mail(betreff:zeile;
               Mitteilung: string;
               Adresse:zeile;
               Dateianhang:string);
Var myoutlook,mailitem : variant;
    anhang : string;
Begin
  myoutlook := createoleobject('Outlook.Application');     // <=== Hier kommt die Fehlermeldung
  mailitem := myoutlook.createitem(0);
  mailitem.subject := betreff;
  if pos('@',adresse) = 0 then
    mailitem.to := 'Conny@diedrexlers.de'
  else
  mailitem.to := adresse;
  mailitem.body := mitteilung + #13 + #13 +
     'Mailversion: ' + umail_const;
  if pos(';',dateianhang) > 0 then
    Begin
      repeat
        if pos(';',dateianhang) > 0 then
          Begin
            anhang := copy(dateianhang,1,pos(';',dateianhang) - 1);
            mailitem.Attachments.add(anhang);
            dateianhang := copy(dateianhang,pos(';',dateianhang) + 1,length(dateianhang));
          end;
      until pos(';',dateianhang) = 0;

    end;
  if dateianhang <> '' then
    mailitem.Attachments.add(dateianhang);
  mailitem.send;
//  mailitem.free;
end;

end.


Moderiert von user profile iconNarses: Code- durch Delphi-Tags ersetzt
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: Mo 05.11.12 23:01 
wenn ich
ausblenden Delphi-Quelltext
1:
myoutlook := createoleobject('Nase.Bär');					


aufrufe bekomme ich exakt dieselbe Fehlermeldung, was mich vermuten lässt dass Outlook auf Deinem Rechner nicht (richtig) installiert ist?

_________________
Das Problem liegt üblicherweise zwischen den Ohren H₂♂
DRY DRY KISS