Converting string arguments to variant type arguments

Converting string arguments to variant type arguments

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

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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)
 bstr1 = ConvertStringToBSTR("Dice Histogram")
 vBSTR1%VU%PTR_VAL = bstr1
 status = VariantClear(vBSTR1)


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.

Leave a Comment

Please sign in to add a comment. Not a member? Join today