Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel variables and VFP
Message
From
30/08/2004 12:24:22
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00937401
Message ID:
00937677
Views:
18
>Hi, When calling VFP from Excel, can VFP be made aware of variables declared in Excel?
>In the following, the variable theLast is declared in Excel but I get an error -- theLast
>does not exist -- when I try to execute a procedure in VFP -- FormatPri() which starts
>with theLast.
>Thanks
>Steve
>
>Sub FormatPrice
>    Dim oVFP As Object
>    Dim theLast as string  && theLast declared
>    Set oVFP = CreateObject("VisualFoxPro.Application")
>    oVFP.Visible = True
>    oVFP.DoCmd "cd c:\page0\"
>    oVFP.DoCmd "set procedure to c:\page0\FormatPrices.prg"
>    Range("A1").Select
>    theLast = ActiveCell.Value
>    oVFP.DoCmd "FormatPri()"    && Can VFP be aware of the value of theLast
>    ActiveCell.Value = theLast
>    oVFP.Quit
>    Set oVFP = Nothing
>End Sub
>
Steve,
Create a COM object in VFP and pass theLast as a parameter. Assign return value to ActiveCell.Value.

It looks like :
Sub FormatPrice
    Dim oVFP As Object
    Set oVFP = CreateObject("myVFPDLL.myClass")
    Range("A1").Value = oVFP.FormatPri(Range("A1").Value)
    Set oVFP = Nothing
End Sub
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform