web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

How to Write in GP Macro IF

(0) ShareShare
ReportReport
Posted on by 55

Im running a macro should fulfill a transfer entry by its self 

but the problem happens when im short with this Qty im that warehouse 

so i wanna tell the macro if it come up the dialog box not enough Qty press ok 

So how do i write if That happen press ok??

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    L Vail Profile Picture
    65,271 on at

    Hi,

    You cannot do this with the macro language. The macro language merely records keystrokes and clicks. It does not evaluate data, respond to window actions, analyze what dialog opens etc. If you want to 'macro' this, you'll need to determine which records are going to show the dialog and macro in the answer. I haven't tried this, but if you're not using the web client maybe you could use VBA to dismiss the dialog before it is presented on screen. The VBA code would 'answer' the question without user intervention.

    Kind regards,

    Leslie

  • Suggested answer
    MG-16101311-0 Profile Picture
    26,225 on at

    The macro language does not support conditional branching and/or control structures. To do what you are proposing, you need an actual customization. For what you are doing, it sounds like VBA would do just fine.

  • ICH BIN ICH Profile Picture
    55 on at

    im talking from this window if you didnt understand

    4263.Untitled.png

    i running a macro should transfer all item from one warehouse sometimes comes up this window

    i Dont understand your answer about VBA What is Vba?

  • ICH BIN ICH Profile Picture
    55 on at

    this is what the macro say 

    # The quantity entered is greater than the quantity available. Do you want to use the quantity available?

    NewActiveWin dictionary 'default' form DiaLog window DiaLog

    MoveTo field CANCEL

    ClickHit field CANCEL

    i want this should be between all items in my macro with a IF

  • Suggested answer
    MG-16101311-0 Profile Picture
    26,225 on at

    Ich,

    We know that you are specifically talking about this dialog -- or any other dialog for that matter. If your macro is recorded to deal with a certain condition, it can only deal with that condition. If GP brings up any other dialog during the course of the macro execution, the macro will fail. Since you cannot create an "If... then" structure inside of the macro, it will always fail execution when a dialog comes up and you need it to do a different action that it was originally recorded to do.

    The only way to address this type of scenario is by using Visual Basic for Applications (VBA) which is a part of the Modifier tool.

  • ICH BIN ICH Profile Picture
    55 on at

    Thanks for your help

    Can you Please explain how do i edit it

    i know how to open it (in word or in notepad++)

    What should i write there??

    very big thank you in advanced

  • MG-16101311-0 Profile Picture
    26,225 on at

    Pardon me, but I don't know what you are referring to. How to edit what exactly? If what you are asking me is how do you add the VBA code, you will need to understand programming first and you will need to know how you can drive windows with it, and frankly, the forums are not a place for this.

  • L Vail Profile Picture
    65,271 on at

    You are not modifying the macro. It simply will not do what you want. You may want to contact your partner and ask them for help on this.

    Kind regards,

    Leslie

  • ICH BIN ICH Profile Picture
    55 on at

    So how can i do it with VBA?

  • MG-16101311-0 Profile Picture
    26,225 on at

    Ich,

    You will first need to open the window in question, then go to the Tools menu and choose the option to Add Current Window to VBA. You will then want to go back to Tools and choose Add Fields to VBA. You will want to point to each field you will be driving via code. Once you are done, you can go back to the Tools menu and select VBA Editor to open the editor. You will then code your fingers away in VB. If you are not a developer, I suggest you reach out to your partner for further assistance.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

#1
mtabor Profile Picture

mtabor 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans