How to Dynamically Interact with VISUAL from another application

There are many options and paths you can take to integrate VISUAL to your other business applications.  Some are easy, and some are not so easy…. some may involve 3rd party integration tools/services and some may require custom programming with APIs and BODs.

However, there is one way where Infor couldn’t make it any easier to integrate….

How to Dynamically Interact with VISUAL from another application

…using a VMX file!

Yup!  That’s right, a VMX file….but a “special” VMX file

I written posts in the past on VMX files….in fact, I wrote one a couple of weeks ago where you can use a VMX as a way to have VISUAL start up with your default windows after signing in.

In this case, we can use a VMX file to interact/interface with VISUAL from another application.  It involves creating a VMX file on the fly based on end-user contextual request on demand…I may have made that terminology up…lol…not sure if that really means what I trying to explain.

Here’s an example…

You could have an excel file with a list of parts where you can click on a cell containing a Part ID to call up VISUAL’s Material Planning Window for the demand and supply of that specific part – without having to leave Excel.  This can be done behind the scenes using simple (more or less) VBA code that creates the VMX file and executes it.

Here’s a visual of it in action

Excel and VISUAL ERP Integration

Double Click on Image for a better visual.

Let me walk you through it

We’re going to create an Excel file with a list of parts that when you select a cell/row – it will open VISUAL Material Planning Window for that specific part.

Now I’m using Excel for my walk through – because it’s easy and everyone uses Excel.  But you can do this with any application where you can program simple code to create a VMX file based on user input.

Assuming we are on VISUAL 9 – (if you are not on Visual 9 – why aren’t you?)

  1. Create an Excel File containing a list of parts with the following columns:
    • Column A: Site ID (required)
    • Column B: Part ID (required)
    • Column C: Description
    • Column D: UM
    • Column E: Qty
  2. Be sure to populate the list with parts starting on Row 2
  3. Open the Visual Basic module of Excel (under the Developer Tab).  If you don’t have the Developer Tab – you will need to enable it – go to File > Options.
  4. Insert the following code in the SelectionChange event/procedure of the worksheet.
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)

    Dim VMPath As String
    Dim VMXPath As String
    Dim PartID As String
    Dim SiteID As String

    ‘Path to your VISUAL executable file – VM.EXE
    VMPath = “{VISUAL Executable Directory}\VM.exe”

    ‘Path to where you want to create your VMX file. You would typlically want
    ‘this to be in your VISUAL local directory
    VMXPath = “{local Directory Path}\VISUAL.VMX”

    If Selection.Count = 1 Then

    If Target.Row > 1 Then
    Set objShell = VBA.CreateObject(“Wscript.shell”)

    PartID = Range(“B” & Target.Row).Value
    SiteID = Range(“A” & Target.Row).Value

    ‘Create the VMX file to open VISUAL Material Planning Window
    Set filesys = VBA.CreateObject(“Scripting.FileSystemObject”)
    Set filetxt = filesys.CreateTextFile(VMXPath, True)
    filetxt.WriteLine (“LSASTART”)
    filetxt.WriteLine (“VMPLNWIN~” & SiteID & “~” & PartID)
    filetxt.Close

    ‘Drilldown into VISUAL using VMX file
    objShell.Exec (“””” & VMPath & “”” “”” & VMXPath & “”””)
    objShell.AppActivate (“Material Planning Window – Infor VISUAL”)

    ‘Focus back to Excel
    Application.Wait (Now + TimeValue(“0:00:02”))
    AppActivate ThisWorkbook.Application.Caption
    End If

    End If

    End Sub

    It may look like a lot of code….but it’s not.

    Be sure to replace directory highlighted in RED to your environment.

  5. You can exit out of the Visual Basic module and return to Excel.
  6. You are good to go.

Click away on any row with a part and you should see VISUAL dynamically respond.

If the above steps are too involved….you can download the example excel file for your convenience

Let me know what you think.

Copyright 2019 visualnuggets © All Rights Reserved