• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: do visual basic
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: do visual basic


  • Subject: Re: do visual basic
  • From: Jay Young <email@hidden>
  • Date: Wed, 10 Mar 2004 18:52:33 -0600

Hi Giampiero,

Another possibility could be to copy it to the clipboard and then have
AS pull the text from there:

----------
tell application "Microsoft Word"
do Visual Basic "Set dObj = New DataObject" & return & "x = 10" &
return & "dObj.SetText x" & return & "dObj.PutInClipboard"
end tell

set vbText to the clipboard

display dialog vbText
----------

Careful of the email wrapping above. The 'do Visual Basic' line of
code between the 'tell' and 'end tell' is 1 line of code.

For some reason I could only get it to work when I added '& return &'
between each line of vba code. If I did this:

----------
tell application "Microsoft Word"
do Visual Basic "Set dObj = New DataObject
x = 10
dObj.SetText x
dObj.PutInClipboard"
end tell
----------

then it would make just 1 line of code in vba which of course would
break the script. I tested this in OS 10.3.2 with Word X.

Hope this helps.

Jay


=========

> From: "Giampiero Cairo" <email@hidden>
> To: <email@hidden>
> Subject: do visual basic
> Date: Wed, 10 Mar 2004 17:08:22 +0100
>
> Hi all,
>
> I use applescript and in particular the command "Do Visual Basic"
>
> I want to get a value of a variable from the routine of Visual basic
> to the
> rest of applescript code.
>
>
> this is my snippet of script:
>
>
> set myvar to ""
>
> Do Visual Basic "
> dim x as string
> x = 10
> Return x
> "
>
> repeat with x from 1 to 10
> set AnotherVar to x + 1
> end repeat
>
>
> Is it correct if I would pass the x value to the rest of my script for
> example to the "repeat cicle"?
>
>
>
> TIA
>
> Giampiero
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: do visual basic
      • From: Paul Berkowitz <email@hidden>
  • Prev by Date: Re: Getting the Folder name when using drag-&-drop Scripts
  • Next by Date: Re: do visual basic
  • Previous by thread: Re: do visual basic
  • Next by thread: Re: do visual basic
  • Index(es):
    • Date
    • Thread