Hallo
Ich habe folgendes Problem. Ich möchte mittels Excel VBA mehrer Parameter in eine Active-X DLL weitergeben (Das Funktioniert). Wie kann ich es anstellen, dass ich im VBA wieder mehrere Parameter von der DLL empfangen kann?
Besten Dank für jeden Hinweis.
Grüsse Sebastian
VB6 Script
Public Function ReadInD(ByVal Web As String) As String
mFilesEinlesen.LizenzManager
Web = CInt(WebseitenShow)
ReadInD = Web
End Function
NHKDatenDLLPath = ActiveWorkbook.Path & IIf(Right(ActiveWorkbook.Path, 1) = „“, „“, „“) & „NHKDaten2.dll“
Shell "regsvr32 /s " & Chr(34) & NHKDatenDLLPath & Chr(34)
Set NHK = CreateObject(„NHKDatenVerarbeitungsDLL.kFunktion“)
Web = NHK.ReadInD(Web)
wenn ich aus einer Prozedur nur eine Variable zurück bekommen möchte, löse ich das so:
Option Explicit
Private Type BeispielTyp
IntVar As Integer
StVar As String
BtAr(10) As Byte
End Type
Dim Test As BeispielTyp
Private Sub Command1\_Click()
Dim i As Byte
tst 12
Me.Cls
Me.Print Test.IntVar
Me.Print Test.StVar
For i = LBound(Test.BtAr) To UBound(Test.BtAr)
Me.Print Test.BtAr(i)
Next
End Sub
Private Sub tst(ByVal a As Integer)
Dim i As Byte
Test.IntVar = a
Test.StVar = Str(a)
For i = LBound(Test.BtAr) To UBound(Test.BtAr)
Test.BtAr(i) = i
Next
End Sub
Ja. leider nicht wirklich, ich mache ja den DLL Aufruf in
Excel, nun möchte ich aber zwei oder mehrer Variabeln aus der
DLL erhalten.
hmmm, was ist das für eine DLL? Hast Du die selbst geschrieben?
In anderen DLLs, die zu Windows gehören, wird das so gemacht. Beispiel:
Private Declare Sub GetSystemInfo Lib "kernel32" (lpSystemInfo As SYSTEM\_INFO)
Private Type SYSTEM\_INFO
dwOemID As Long
dwPageSize As Long
lpMinimumApplicationAddress As Long
lpMaximumApplicationAddress As Long
dwActiveProcessorMask As Long
dwNumberOrfProcessors As Long
dwProcessorType As Long
dwAllocationGranularity As Long
dwReserved As Long
End Type
Private Sub Form\_Load()
Dim SInfo As SYSTEM\_INFO
'KPD-Team 1998
'URL: http://www.allapi.net/
'[email protected]
'Set the graphical mode to persistent
Me.AutoRedraw = True
'Get the system information
GetSystemInfo SInfo
'Print it to the form
Me.Print "Number of procesor:" + str$(SInfo.dwNumberOrfProcessors)
Me.Print "Processor:" + str$(SInfo.dwProcessorType)
Me.Print "Low memory address:" + str$(SInfo.lpMinimumApplicationAddress)
Me.Print "High memory address:" + str$(SInfo.lpMaximumApplicationAddress)
End Sub
Der Name der Benutzerdefinierten Variablen wird mit dem DLL-Aufruf mitgegeben und es kommen eine Reihe Werte zurück, die alle als Eigenschaft dieser Benutzerdefinierten Variable erscheinen. Ich fürchte, das ist ein Hinweis darauf, daß Du diesen Weg gehen mußt.