Dim IsOpen As String
Dim Loopcnt As Integer
Dim MaxLoops As Integer
Dim shell
Dim oNetwork 'Network Access Object
Dim sUserName 'Login Name of User
Set oNetwork = CreateObject("Wscript.Network")
sUserName = oNetwork.UserName
IsOpen = "N"
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name = 'VMMFGWIN.EXE'")
For Each objProcess In colProcessList
If objProcess.GetOwner(tUser, Domain) = 0 Then
If tUser = sUserName Then
IsOpen = "Y"
End If
End If
Next
If IsOpen = "Y" Then
Set shell = CreateObject("WSCRIPT.SHELL")
shell.Run """\\Ct01\root\Visual\Scripts\OpenWO.vbs"" """ & Me.Base_ID & """ " & Me.Lot_ID & " " & IsOpen, , False
Else
MsgBox "Manufacturing Window must be open before you can open the Work Order"
End If
Set shell = Nothing
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE