Sunday, March 1, 2015

Infor Visual Enterprise Macros

Here are some macro information for Visual Enterprise.
Macros are basically vbscript and you can get more help from the Infor website.

Here are three examples that we use all the time.

This one takes the packlist from the shipping window and sends it to Microsoft SQL reporting services to create a report in PDF format.
Filename: VMSHPENT_Print Cert.vms

Dim ie,ss
sub pause(secs)
start = now
secs = cint(secs)
while datediff("s",start,now) < secs: wend
end sub

set ie = CreateObject("InternetExplorer.Application")

ie.Navigate "http://sharepoint/reportserver?%2fVisual+Enterprise+Shop+Reports%2fSkills+Cert+for+Laser+Printers&rs:Command=Render&rs:Format=PDF&PACKLIST=" & PACKLIST_ID

ie.Height = 50
ie.Width = 500
ie.Visible = false
pause 4
Set ss = CreateObject("WScript.Shell")
ss.AppActivate "File Download"
ss.sendkeys "%o"

Im sorry if this blog chops some of this into more than one line.
Make sure the ie.Navigate is one line and then the next line is ie.Height = 50.

This next one just enters some data into a box for you.
Thats right, just one line!
filename: VMMFGWIN_Submitted to Vendor.vms

udfString1 = "Submitted to Vendor"


This one goes into a database and pulls some information about the customer and enters it into a box for you.
filename: VMORDENT_Fill in product code.vms

Dim SQLString
Const DB_CONNECT_STRING = "Provider=SQLOLEDB.1;Data Source=MYSERVER; Initial Catalog=MYDATABASE;User Id=macro;Password=somereadonlypassword"
Set MyDB = CreateObject("ADODB.Connection")
MyDB.Open(DB_CONNECT_STRING)


SQLString = "select USER_9 FROM CUSTOMER WHERE (ID = " & CUSTOMER_ID & ")"
set rsSystemName = MyDB.Execute(SQLString)
GetPC = rsSystemName.Fields("User_9")
MyDB.Close

Set OrderLns = LINES.Value

For i = 0 to OrderLns.Count -1

Set OrderLn = OrderLns(i)

sOrderLn = OrderLn("LINE_NO")

If OrderLn("PRODUCT_CODE")="" Then

OrderLn("PRODUCT_CODE")= GetPC

End If

Next

Set OrderLn = Nothing

Set OrderLns = Nothing
for details click below

No comments:

Post a Comment