Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

How can I get value of TreeView selected Node in VBA?

(0) ShareShare
ReportReport
Posted on by 45

Hi,

I am trying to get value of selected node of TreeView in VBA on Select In-Transit Items window. 

I have added TreeView control field in VBA and when I tried to get Value, It always returns empty. How can I get that selected value?

See below screenshot.

pastedimage1648137955530v2.png

Thanks,

Atul

Categories:
  • David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    David Musgrave MVP ... 13,932 Most Valuable Professional on at
    RE: How can I get value of TreeView selected Node in VBA?

    The following example shows how you can call Dexterity SanScript code from VBA

    winthropdc.wordpress.com/.../

    Here is some example code:

    local long node_ID;

    local string node_label;

    {Get the ID of the selected node.}

    node_ID = TreeView_GetSelectedNode('TreeView' of window WindowName of form FormName);

    if node_ID <> TV_NODEINVALID then

       {Get the node label.}

       node_label = TreeView_GetNodeLabel('TreeView' of window WindowName of form FormName, node_ID);

    else

       warning "No item is selected in the Address List field.";

    end if;

  • Suggested answer
    David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    David Musgrave MVP ... 13,932 Most Valuable Professional on at
    RE: How can I get value of TreeView selected Node in VBA?

    Hi Autel

    The only method that will work from VBA is pass through sanScript and using the Dexterity commands.

    I would recommend that you move away from VBA which is "End of Life" and does not work on the web client and Windows Servers.

    Instead you should look to the alternatives, Dexterity, Visual Studio Tools or better still GP Power Tools which is a perfect replacement for VBA as well as offering many other must have features.

    See: https://winthropdc.wordpress.com/2019/08/12/gppt-replacing-vba-with-gp-power-tools-developer-tools/

    Also see the Benefits Presentation: https://www.winthropdc.com/ftp/pub/GPPowerTools_Benefits.ppsx

    David

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

News and Announcements

Announcing Category Subscriptions!

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,359 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans