Trying to appactivate ERP window

Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server 2010
I am trying to switch between outlook and my ERP system ( visual enterprise) but cannot get visual to activate.

I put path as" \\visualsql\apps\vmfg\VM.EXE" but it just open a login for administrator.

The module window that is open is estimating window VMESTWIN.EXE if I add that to path it opens same login.

Is there a way to activate the open window I have ?

this is what I am using: Which just open administrator login box.

Public vPID As Variant
Public Sub OpenApplication()
'Launch application if not already open
If vPID = 0 Then 'Application not already open
101:
vPID = Shell("\\visualsql\apps\vmfg\VMESTWIN.EXE", vbNormalFocus)
Else 'Application already open so reactivate
On Error GoTo 101
AppActivate (vPID)
End If
End Sub
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Where are you assigning a value to vpid? As written, its always going to open a new window because vpid will always be 0.

This works to bring an open notepad file into focus:
Public Sub OpenApplication()
vPID = "notepad"
AppActivate (vPID)
End Sub



This might work for you - you should use the process friendly name. In the examples in the screenshot, you only need the program name - excel, chrome, teams, edge (but t works with the full name). Also, if the application is minimized, it takes focus (the button highlights) but will not open on screen.

Public Sub OpenApplication()
vPID = "VMESTWIN"
On Error GoTo 101

AppActivate (vPID)
j = 1
Debug.Print j
101:
If j = 0 Then
vPID = Shell("\\visualsql\apps\vmfg\VMESTWIN.EXE", vbNormalFocus)
End If
End Sub

process.png
 
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server 2010
Diane, Hi. thanks. I can get notepad to open - #1 below works.
and example #2 to open outlook works.

But if I put "VMESTWIN" into code I get run-time error '53' file not found. ?

#1 - works.
Public vPID As Variant
Public Sub OpenApplication()
'Launch application if not already open
If vPID = 0 Then 'Application not already open
101:
vPID = Shell("NOTEPAD", vbNormalFocus)
Else 'Application already open so reactivate
On Error GoTo 101
AppActivate (vPID)
End If
End Sub
or

#2 - works
Public vPID As Variant
Public Sub OpenApplication()
'Launch application if not already open
If vPID = 0 Then 'Application not already open
101:
vPID = Shell("OUTLOOK ", vbNormalFocus)
Else 'Application already open so reactivate
On Error GoTo 101
AppActivate (vPID)
End If
End Sub

#3 - DOES not work. ??????
Public vPID As Variant
Public Sub OpenApplication()
'Launch application if not already open
If vPID = 0 Then 'Application not already open
101:
vPID = Shell("vmestwin", vbNormalFocus)
Else 'Application already open so reactivate
On Error GoTo 101
AppActivate (vPID)
End If
End Sub

VMESTWIN.PNG
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
on the general tab of properties, what is the description ? try using that word(s)
 
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server 2010
Diane,

I tried following but get run-time error '53" file not found.

Public Sub OpenApplication()
vPID = "VISUAL"
On Error GoTo 101
AppActivate (vPID)
j = 1
Debug.Print j
101:
If j = 0 Then
vPID = Shell("\\visualsql\apps\vmfg\VISUAL", vbNormalFocus)
End If
End Sub

general tab.PNG
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
this: vPID = Shell("\\visualsql\apps\vmfg\VISUAL
i think you may need to use the full path to the exe if not found and just visual (or whatever is showing as the process name in task manager) for the if running version.
 
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server 2010
Diane,

below is opening sysadm login for vmestwin.exe from server location " \\visualsql\apps\vmfg\VMESTWIN.EXE"
See below visual properties screen shot.

what is active is starting from U:/VISUAL.... which is where INI files for user are located.

maybe I am missing something from my path, my full path is not correct.

any other ideas ?



Public Sub OpenApplication()
vPID = "VISUAL"
On Error GoTo 101
AppActivate (vPID)
j = 1
Debug.Print j
101:
If j = 0 Then
vPID = Shell("\\visualsql\apps\vmfg\VMESTWIN.EXE", vbNormalFocus)
End If
End Sub

TEST 3.PNG
 

Mark White

Member
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server
You might try using Explorer to do it for you... using the file path (strFilePath)

VBA.Shell "Explorer.exe " & Chr(34) & strFilePath & Chr(34), vbNormalFocus ' Use Windows Explorer to launch the file.
 
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server 2010
Mark,
Thanks ! I am new to VB... do you have a complete example that I can look at for ref. ?

Kurt
 

Mark White

Member
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server
Sadly no... just dim the variable strFilePath, then in yr code say where it is strFilePath = ".....\...\...exe" and then on the next line use the code I sent before... so
dim strFilePath as string
strFilePath = "C:\Users\" & Environ("username") & "\Documents\BlarBlarBar.exe"
VBA.Shell "Explorer.exe " & Chr(34) & strFilePath & Chr(34), vbNormalFocus
 

Mark White

Member
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server
Ooops... you're using VB my code is VBA... Sorry- prolly worth a try though
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Diane,

below is opening sysadm login for vmestwin.exe from server location " \\visualsql\apps\vmfg\VMESTWIN.EXE"
See below visual properties screen shot.

what is active is starting from U:/VISUAL.... which is where INI files for user are located.

maybe I am missing something from my path, my full path is not correct.
u:/visual is the startin directory - this is the path to the actual \\visualsql\apps\vmfg\VMESTWIN.EXE exe. I think you'd want to use the path to the exe, at least if its not already running.
 
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server 2010
Diane,

thinking here now it has something to do with password. if I open estwin from within visual it activates. ( no problem)

if I try to appactive using vmestwin.exe it opens a login.

is there anything you know I can incorportate that" username" something like Mark Whites example. ?
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
try Shell "runas /user:domain\username" "c:\program files\internet explorer\iexplore", vbNormalFocus - you'll need to enter the password - I'm not aware of anyway to pass the password to the dialog.
 
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server 2010
Diane,

thanks you!!

Ok. I got this. Thanks for the help. after .exe I had to specify database, username, and password.
If visual is not open. if visual estimating window is open just appactivate "estimating".

Working example below:

Public vPID As Variant
Public Sub OpenApplication()
'Launch application if not already open
If vPID = 0 Then 'Application not already open
101:
vPID = Shell("\\visualsql\apps\vmfg\VMESTWIN.EXE -DVMFG -UKAS -PKAS", vbNormalFocus)
Else 'Application already open so reactivate
On Error GoTo 101
AppActivate ("ESTIMATING")
End If
End Sub
 
Top