Article ID: 151637
Article Last Modified on 12/15/1999
-- Save this script as "Excel2VFP"
tell application "Microsoft Excel"
Activate
set Range "R1C1" to "Data to go to Visual FoxPro"
get Range "R1C1"
--get Value of Range "R1C1"
set myVar to the result
end tell
tell application "Microsoft Visual FoxPro"
Activate
Do Script "SET DEFAULT TO HOME()"
Do Script "DO TEST WITH '"& myVar &"'"
end tell
Enter the Visual FoxPro program:
* Save this program as "Test" in the Visual FoxPro folder
PARAMETER MyVar
LenMyVar = LEN(MyVar)
=MessageBox("The length of the data from Excel is ";
+LEFT(STR(LenMyVar)))
Run the script and note that you get the following error message:
What you attempted to do was try to pass an Excel "Range" to Visual FoxPro,
which does not understand what a range of cells is. To work around this
behavior, comment out the line [get Range "R1C1"] and uncomment the line
[--get Value of Range "R1C1"].
-- Save this script as "STE2VFP"
tell application "Scriptable Text Editor"
activate
open file "Macintosh HD:TestText"
get contents of document 1
-- get contents of document 1 as string
set myVar to the result
quit
end tell
tell application "Microsoft Visual FoxPro"
Activate
Do Script "SET DEFAULT TO HOME()"
Do Script "DO TEST2 WITH '"& myVar &"'"
end tell
Enter the Visual FoxPro program:
* Save this program as "Test2" in the Visual FoxPro folder
PARAMETER MyVar
LenMyVar = LEN(MyVar)
=MessageBox("The length of the data from Scriptable Text Editor is ";
+LEFT(STR(LenMyVar)))
Enter the Scriptable Text Editor file 'TestText':
This is a test of VFP and AppleScript.
Additional query words: VFoxMac
Keywords: KB151637