AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Programmieren allgemein Excel.Interop OLE -> Problem beim Hyperlink lesen
Thema durchsuchen
Ansicht
Themen-Optionen

Excel.Interop OLE -> Problem beim Hyperlink lesen

Offene Frage von "shmia"
Ein Thema von Master_BB · begonnen am 25. Sep 2008 · letzter Beitrag vom 13. Jul 2010
Antwort Antwort
Master_BB

Registriert seit: 17. Mai 2003
285 Beiträge
 
Delphi 7 Professional
 
#1

Excel.Interop OLE -> Problem beim Hyperlink lesen

  Alt 25. Sep 2008, 10:51
Hy,
ich habe gerade das Problem das ich wenn ich einen Hyperlink auslese immer ein "Mitglied nicht gefunden" fehler bekomme.
Code sieht so aus
Delphi-Quellcode:
  FExcel := CreateOleObject('Excel.Application');
  FExcelWorkBook := FExcel.Workbooks.Open(AFilePath);
  ACount := FExcelWorkbook.ActiveSheet.Hyperlinks.Count;
  AHypLink := FExcelWorkbook.ActiveSheet.Hyperlinks.Item(1); //->fehler obwohl ACount = 2
das selbe bei Word läuft ohne probleme.

Weiß jemand was der Key für die Items in der Hyperlinks liste ist? In word wars einfach durchnummeriert,
hier könnten es ja Col+Row oder A1....An sein.

Wenn jemand nen Tip hat wäre das außerordentlich schön

gruß
Wenn das Meer unruhig ist und der Wind die Wellen treibt, erfreut es, vom Strand aus die Mühen eines Anderen zu beobachten.
  Mit Zitat antworten Zitat
Master_BB

Registriert seit: 17. Mai 2003
285 Beiträge
 
Delphi 7 Professional
 
#2

Re: Excel.Interop OLE -> Problem beim Hyperlink lesen

  Alt 25. Sep 2008, 12:23
ok ich hab das problem jetzt selber gelößt und zwar läuft der Code wenn man Hyperlinks als Array auffasst.
Delphi-Quellcode:
  FExcel := CreateOleObject('Excel.Application');
  FExcelWorkBook := FExcel.Workbooks.Open(AFilePath);
  ACount := FExcelWorkbook.ActiveSheet.Hyperlinks.Count;
  AHypLink := FExcelWorkbook.ActiveSheet.Hyperlinks[1];
bei Word jedoch funktioniert es auch so
AHypLink := FWord.ActiveDocument.Hyperlinks.Item(AHypLinkIdx); Das ist komisch, ist aber so g.

Gruß
Wenn das Meer unruhig ist und der Wind die Wellen treibt, erfreut es, vom Strand aus die Mühen eines Anderen zu beobachten.
  Mit Zitat antworten Zitat
DUCATI9

Registriert seit: 11. Aug 2008
1 Beiträge
 
#3

Re: Excel.Interop OLE -> Problem beim Hyperlink lesen

  Alt 1. Feb 2009, 16:17
Hallo MasterBB,

ich stecke soeben über dem selben Problem, wo Du die Lösung gefunden hast, ich aber nicht anwenden kann.

Meine Problem, ich möchte aus einer Excel Tabelle aus Zellen die Hyperlinks auslesen.

Leider funktioniert folgendes nicht.

linktext,link : String;

linktext:=ExcelApp.Cells[1,1].Value;
if ExcelApp.Activecell.Hyperlinks.count>0 then
link:=ExcelApp.ActiveCell.Hyperlinks[1];

Die Fehlermeldung lautet ... Variante des Type Dispatch konnten nicht in String konvertiert werden.

Wie kann ich einfach aus einer Zelle den Link auslesen?

Vielen Dank für eure Hilfe!

Grüsse

Robert
  Mit Zitat antworten Zitat
Master_BB

Registriert seit: 17. Mai 2003
285 Beiträge
 
Delphi 7 Professional
 
#4

Re: Excel.Interop OLE -> Problem beim Hyperlink lesen

  Alt 2. Feb 2009, 15:11
auf die schnelle würd ich meinen das bei 0 angefangen wird zu zählen
daher probiers mal mit
link:=ExcelApp.ActiveCell.Hyperlinks[0];
Wenn das Meer unruhig ist und der Wind die Wellen treibt, erfreut es, vom Strand aus die Mühen eines Anderen zu beobachten.
  Mit Zitat antworten Zitat
buchsbaum

Registriert seit: 21. Jul 2009
9 Beiträge
 
#5

AW: Excel.Interop OLE -> Problem beim Hyperlink lesen

  Alt 13. Jul 2010, 08:41
Hallo

Ich habe ebenfalls versucht, die Hyperlinks aus einer Excel-Datei auszulesen. Dazu habe ich den oben genannten Code verwendet:

AHypLink := FExcelWorkbook.ActiveSheet.Hyperlinks[1];

Leider weiß ich nicht genau, welchen Datentyp ich für AHypLink definieren muss.
  Mit Zitat antworten Zitat
shmia

Registriert seit: 2. Mär 2004
5.508 Beiträge
 
Delphi 5 Professional
 
#6

AW: Excel.Interop OLE -> Problem beim Hyperlink lesen

  Alt 13. Jul 2010, 09:09
Leider weiß ich nicht genau, welchen Datentyp ich für AHypLink definieren muss.
Delphi-Quellcode:
var
  AHypLink : OleVariant;
Mit AHypLink.Address müsstest du an den Link als String kommen.

Hier noch das Interface dazu:
Code:
 interface IHyperlink : IDispatch {
        [propget, helpcontext(0x00010094)]
        HRESULT _stdcall Application([out, retval] Application** RHS);
        [propget, helpcontext(0x00010095)]
        HRESULT _stdcall Creator([out, retval] XlCreator* RHS);
        [propget, helpcontext(0x00010096)]
        HRESULT _stdcall Parent([out, retval] IDispatch** RHS);
        [propget, helpcontext(0x0001006e)]
        HRESULT _stdcall Name([out, retval] BSTR* RHS);
        [propget, helpcontext(0x000100c5)]
        HRESULT _stdcall Range([out, retval] Range** RHS);
        [propget, helpcontext(0x0001062e)]
        HRESULT _stdcall Shape([out, retval] Shape** RHS);
        [propget, helpcontext(0x000105bf)]
        HRESULT _stdcall SubAddress([out, retval] BSTR* RHS);
        [propput, helpcontext(0x000105bf)]
        HRESULT _stdcall SubAddress([in] BSTR RHS);
        [propget, helpcontext(0x000100ec)]
        HRESULT _stdcall Address([out, retval] BSTR* RHS);
        [propput, helpcontext(0x000100ec)]
        HRESULT _stdcall Address([in] BSTR RHS);
        [propget, helpcontext(0x0001006c)]
        HRESULT _stdcall Type([out, retval] long* RHS);
        [helpcontext(0x000105c4)]
        HRESULT _stdcall AddToFavorites();
        [helpcontext(0x00010075)]
        HRESULT _stdcall Delete();
        [helpcontext(0x00010650)]
        HRESULT _stdcall Follow(
                        [in, optional] VARIANT NewWindow,
                        [in, optional] VARIANT AddHistory,
                        [in, optional] VARIANT ExtraInfo,
                        [in, optional] VARIANT Method,
                        [in, optional] VARIANT HeaderInfo);
        [propget, helpcontext(0x0001075b)]
        HRESULT _stdcall EmailSubject([out, retval] BSTR* RHS);
        [propput, helpcontext(0x0001075b)]
        HRESULT _stdcall EmailSubject([in] BSTR RHS);
        [propget, helpcontext(0x00010759)]
        HRESULT _stdcall ScreenTip([out, retval] BSTR* RHS);
        [propput, helpcontext(0x00010759)]
        HRESULT _stdcall ScreenTip([in] BSTR RHS);
        [propget, helpcontext(0x0001075a)]
        HRESULT _stdcall TextToDisplay([out, retval] BSTR* RHS);
        [propput, helpcontext(0x0001075a)]
        HRESULT _stdcall TextToDisplay([in] BSTR RHS);
        [helpcontext(0x0001075c)]
        HRESULT _stdcall CreateNewDocument(
                        [in] BSTR Filename,
                        [in] VARIANT_BOOL EditNow,
                        [in] VARIANT_BOOL Overwrite);
    };
Andreas
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 03:07 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz