AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Funktion aus DLL in Excel verwenden

Ein Thema von Jens Schumann · begonnen am 26. Aug 2007 · letzter Beitrag vom 9. Sep 2007
Antwort Antwort
Benutzerbild von Jens Schumann
Jens Schumann

Registriert seit: 27. Apr 2003
Ort: Bad Honnef
1.644 Beiträge
 
Delphi 2009 Professional
 
#1

Re: Funktion aus DLL in Excel verwenden

  Alt 9. Sep 2007, 18:22
Hallo Jürgen,
nach dem ich die DLL ins system32 geschoben habe läuft es einwandfrei.

Dies sind die Funktionen, die die DLL exportiert
Delphi-Quellcode:
function TPMValue1(Year, Partner, Entity, Posnr, Bwa : PChar) : Double; stdcall;
function TPMValue2(Year,Partner, Entity, Posnr : PChar) : Double; stdcall;
function TPMValue3(Year, Entity , Posnr : PChar) : Double; stdcall;
function TPMValue4(Year, Entity, Posnr, Bwa : PChar) : Double; stdcall;
Die Paramer sind ausschließlich Strings

In Excel werden die Funktionen wie folgt importiert.
Code:
Public Declare Function TPMValue1 Lib "tpmdirect" (ByVal Year As String, ByVal Partner As String, ByVal Entity As String, ByVal Posnr As String, ByVal Bwa As String) As Double
Public Declare Function TPMValue2 Lib "tpmdirect" (ByVal Year As String, ByVal Partner As String, ByVal Entity As String, ByVal Posnr As String) As Double
Public Declare Function TPMValue3 Lib "tpmdirect" (ByVal Year As String, ByVal Entity As String, ByVal Posnr As String) As Double
Public Declare Function TPMValue4 Lib "tpmdirect" (ByVal Year As String, ByVal Entity As String, ByVal Posnr As String, ByVal Bwa As String) As Double

Function TPM_Value1(ByVal Year As String, ByVal Partner As String, ByVal Entity As String, ByVal Posnr As String, ByVal Bwa As String) As Double
  TPM_Value1 = TPMValue1(Year, Partner, Entity, Posnr, Bwa)
End Function

Function TPM_Value2(ByVal Year As String, ByVal Partner As String, ByVal Entity As String, ByVal Posnr As String) As Double
  TPM_Value2 = TPMValue2(Year, Partner, Entity, Posnr)
End Function

Function TPM_Value3(ByVal Year As String, ByVal Entity As String, ByVal Posnr As String) As Double
  TPM_Value3 = TPMValue3(Year, Entity, Posnr)
End Function


Function TPM_Value4(ByVal Year As String, ByVal Entity As String, ByVal Posnr As String, ByVal Bwa As String) As Double
  TPM_Value4 = TPMValue4(Year, Entity, Posnr, Bwa)
End Function
Da ich die importierten Funktionen nicht direkt in der Zelle verwenden kann (weiss nicht warum) habe ich mir eine VBA Wrapper-Funktion geschrieben. Geht wie geschmiert.

Was mir jetzt noch fehlt ist die Übergabe eines Strings aus der DLL ins Excel.
I come from outer space to save the human race
  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 01:59 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz