Skip to main content

Notifications

Power Automate - Power Automate Desktop
Answered

vbScript output syntax?

(0) ShareShare
ReportReport
Posted on by 79

Hi,

I am running PAD for SAP using vbScript and had echo out 4 items into it's variable hereby %VBScriptOutput%

How do i write each item onto excel?
i tried %VBScriptOutput[1]% onto cell A1 but it only wrote 9, how do i write the entire 99047030 onto cell A1?

What is the syntax i should put?

Thanks

 

Zy_Sin_0-1712331847621.png

 

  • eetuRobo Profile Picture
    eetuRobo 2,604 on at
    Re: vbScript output syntax?

    I think the issue there is that your syntax is doing if without comparing it to anything. You would need to compare it to something. What are you trying to check in that if statement?

    So lets assume %TextList[1]% = 123. Your syntax is asking "If Not 123 then do something" but the syntax doesn't determine what should be 123. 
    Also I am not sure but it might be better to use <>
    So if you want to check if it is empty then:
    If %TextList[1]% <> "" Then

  • Zy_Sin Profile Picture
    Zy_Sin 79 on at
    Re: vbScript output syntax?

    Hi 
    it works

    can you help with this syntax

    i want it to do the following if the split text item 1 is not empty but it don't seem to work for what i wrote here

    if Not %TextList[1]% Then

    ....

    thanks

    Zy_Sin_0-1712337954110.png

     

  • Verified answer
    Deenuji_Loganathan_ Profile Picture
    Deenuji_Loganathan_ 6,075 on at
    Re: vbScript output syntax?

    @Zy_Sin 

    Please follow the below suggested approach.

    First use split function and split your text variable(vbscriptoutput) with newline and iterate with foreach and write into your excel.

    Deenuji_0-1712332500724.png

     

    Code:

     

    Excel.LaunchExcel.LaunchUnderExistingProcess Visible: True Instance=> ExcelInstance
    SET VBScriptOutput TO $'''99047030
    90019853
    0.00
    515.83'''
    Text.SplitText.Split Text: VBScriptOutput StandardDelimiter: Text.StandardDelimiter.NewLine DelimiterTimes: 1 Result=> TextList
    LOOP FOREACH CurrentItem IN TextList
     Excel.GetFirstFreeRowOnColumn Instance: ExcelInstance Column: $'''A''' FirstFreeRowOnColumn=> FirstFreeRowOnColumn
     Excel.WriteToExcel.WriteCell Instance: ExcelInstance Value: CurrentItem Column: $'''A''' Row: FirstFreeRowOnColumn
    END

     

     

    How to copy/paste above code into your power automate flow?

    Deenuji_1-1712332609893.gif

     


    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Kickstarter Events…

Register for Microsoft Kickstarter Events…

Tuesday Tip #12 Start your Super User…

Welcome to a brand new series, Tuesday Tips…

Tuesday Tip #13 Writing Effective Answers…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 144,858

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,505

Leaderboard