Randy Dowdy
Posts: 1
Joined: 2010-12-10
|
I have a user defined Visual Basic utility that converts a Hyperlink to a Two part string for some automation purposes. I wish to convert that VB function to Add-Express addin. I am not clear as to what my VarTYpe is for a hyperlink
Here is the code I use in VB
Function HyperLinkText(pRange As Range) As String
Dim ST1 As String
Dim ST2 As String
If pRange.Hyperlinks.Count = 0 Then
Exit Function
End If
ST1 = pRange.Hyperlinks(1).Address
ST2 = pRange.Hyperlinks(1).SubAddress
If ST2 <> "" Then
ST1 = "[" & ST1 & "]" & ST2
End If
HyperLinkText = ST1
End Function
I currently I am pulling the range in as a variant* and I used your Excel automation as my shell so far I have this
function TcoExcelAddin.Hyperlinktext(var Range: OleVariant): OleVariant;
var
Str1,
Str2 : String;
begin
Result := '';
case Vartype (Range) of
end;
end;
I need to know what the Vartype will be to complete the code |
|
Dmitry Kostochko
Add-in Express team
Posts: 2875
Joined: 2004-04-05
|
Hi Randy,
I think you will get the varUnknown or varDispatch values if passing the IRange interface (or ExcelRange dispinterface) to your Delphi function.
Please note that you can also use native types instead of OLEVariant in your Delphi code, like you did in your VB function:
function TcoExcelAddin.Hyperlinktext(const Range: Excel2000.ExcelRange): string; |
|