Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28988 Discussions

Converting string arguments to variant type arguments

selahattin
Beginner
901 Views
Working with Excel, I have to use function or subroutine subprograms defined in EXCEL97A.f90 given with CVF.
However , this subroutines accept some arguments as Variant type. for instance, to give worksheet names to workbook or to select a sheet with its names like occuring at the worksheets_Select function.
Question is how I can convert my character strings to variant type arg?
Secondly, I don't know anything about VB or C languages.
Where can I find doc about this conversion?
Thank you
Regards
0 Kudos
2 Replies
isn-removed200637
901 Views
Look at the AUTODICE example, which shows how to initialise, define and release a variant e.g.
 CALL VariantInit(vInt)
 vInt%VT = VT_I4
 vInt%VU%LONG_VAL = 11
 CALL VariantInit(vBSTR1)
 vBSTR1%VT = VT_BSTR
 bstr1 = ConvertStringToBSTR("Dice Histogram")
 vBSTR1%VU%PTR_VAL = bstr1
.....
.....
 status = VariantClear(vBSTR1)


HTH.
0 Kudos
selahattin
Beginner
901 Views
Hi Tonyrichards,
Thank you very much for your reply.
I use the method shown at autodice sample in my program successfully.
But I tried the same method at
Worksheet_Select function for selection any sheet from workbook or WorkSheet_Add function for adding sheet before/after any sheet. It doesn't work.
If you have any idea, it is appreciated.
Regards
0 Kudos
Reply