• 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: Can Excel "Undefine" a Variable?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can Excel "Undefine" a Variable?


  • Subject: Re: Can Excel "Undefine" a Variable?
  • From: Deivy Petrescu via AppleScript-Users <email@hidden>
  • Date: Mon, 16 Dec 2024 09:04:33 -0300
  • Ui-outboundreport: notjunk:1;M01:P0:PTTTGpHYIvk=;t5JczMwV/+hTk+4Qwg0ufM48Nz1 iAwVicdEYVY3PBleQT++qvtAQk/1ZUwg1yFoQCCBAHwGYXGADnS73aikYhxp8MXiaYPEOhySY 43Veami0aE1UhUwmQM3rzxZqsqQyS4zB1jeoSq7HEPV+cCSp/eERtzoKaXwCLexmkNWdBas8l eFCLXRy5egyTECnXRjR/0aDooh5nchCFwwr/ftqJpRSHnVa8tt++pn+S1jy297MU8WhAVIcTI sYZl+XN+AuM0hDTdLPwNzDB8JWqATSssZ+B4FFL3Eyv45MvUS/po2rTRjL0gOtB1Uy5kUd/j9 r+Tc/SIcBO9lEq8L1L3aUIM5tzPZ13YK0ivdXWsQBFLelUz/jNRZHhlF9BS2JgF95eJHNr76v nJunfxUw1M0vGeNxnqXMrw/iWWM+ixb2R8E9ZBc8Vl2dBkBaey7udEo6LAGV249WKQBABFVZo qDr3FLyQQjIGewGmK7ByJkdV3NEDOjwq/aPraH2z0Kh/Nsw5qxP97uOO6kE79EeH7u3V4ELMb trubiuzkjvnkG3l5qkPJlNBtEPhfeDtMpdFrVhmB4lRzNZjy82fTfjBSUNnsUosvbG7qaQAgb tE13STvmsRznbeu6Tv0XG0oZphyo9gzKERpHf5+vQPoEpEAoMpGD4PXd16qVRUvgivah1OqYM gN+bHLR92iadmTryD8ki3c0UbnuIKiFGXxkO9NevkAdEkyTP3HclEp3iTb/LBVO9QgBDpvHMw fWfd0wdVSxGQhXGLX7loC/k+9p/cJjWH8qmb78V9ia6vo0yrtDoJvYvs9GyTgiMZL7rdRt0Wb awgN+nqH0Cp1zJ5TknyOKKJBRDArwrgNbTC+c8iN6Xmpfki19GKrSPEzeNkRYQ15Y6LOzdq3s W041foliWgQhsiVZrWvhtc/+1fUQQIWnSKQh2578H72hDpGfb4TlIodB1l4LitjGs4RYGDRXK 4cDr0cG3aFntaa31VuAWfRgsEn3qDi4voT2zVJzWLt9a0EIq0dAagqU4OFrq7bzN+zexno3lV b4ORW4YF16zuF0L2FnUKZ+Iq01cv0Idvp2Zc+Tf


> On Dec 15, 2024, at 7:56 PM, Gil Dawson via AppleScript-Users
> <email@hidden> wrote:
>
> Hi-
>
> Working on an AppleScript/Excel/... project, I have come across a second
> Excel oddity.  Having enjoyed great success with a previous problem (Thanks,
> J.S.), I now present this second one:
>
> Using Script Debugger V8.0.8 and Excel 16.90 running under Sequoia 15.2
> 3 in my MacBook Air M1, 2020...
>
> The following code works jes' fine:
>
> tell application "Microsoft Excel"
> set SubscriberAddress to (the value of cell "A2")
> log "the length of SubscriberAddress=" & the length of SubscriberAddress
> --(58)
> set SubscriberAddress to (text 15 through -1 of SubscriberAddress)
> -- Odd, that the following line makes "SubscriberAddress" undefined:
> --set SubscriberAddress to (text 15 through -1 of (the value of cell "A2"))
> end tell
>
> log "SubscriberAddress=" & SubscriberAddress <-- 1735... (and so on for 58
> characters.  Looks OK.)
>
> However, if I uncomment that last "set", while using the same spreadsheet,
> the resulting code gets an error:
>
> tell application "Microsoft Excel"
> set SubscriberAddress to (the value of cell "A2")
> log "the length of SubscriberAddress=" & the length of SubscriberAddress
> --(58)
> set SubscriberAddress to (text 15 through -1 of SubscriberAddress)
> -- Odd, that the following line makes "SubscriberAddress" undefined:
> set SubscriberAddress to (text 15 through -1 of (the value of cell "A2"))
> end tell
>
> log "SubscriberAddress=" & SubscriberAddress --(Does not execute)
>

PNG image

>
> The purpose of the third "set" (the commented/uncommented "set") was to
> consolidate the other two.
>
> Instead, it appears that it makes the target variable become "undefined".
>
> The workaround is simple enough, but I'm curious:
>
> Might you have an explanation for what is happening here?
>
> --Gil
> _______________________________________________

It is a while since I scripted Excel, but I believe the issue is with AS.
Try:

set SubscriberAddress to (text 15 through -1 of ( get the value of cell "A2"))

I added the “get”.
I’ve noticed this need to put get before certain calls for a while now.


Best, be safe.

Deivy Petrescu
email@hidden






 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Can Excel "Undefine" a Variable?
      • From: Gil Dawson via AppleScript-Users <email@hidden>
References: 
 >Can Excel "Undefine" a Variable? (From: Gil Dawson via AppleScript-Users <email@hidden>)

  • Prev by Date: Can Excel "Undefine" a Variable?
  • Next by Date: Re: Can Excel "Undefine" a Variable?
  • Previous by thread: Can Excel "Undefine" a Variable?
  • Next by thread: Re: Can Excel "Undefine" a Variable?
  • Index(es):
    • Date
    • Thread