Is there a good VB Script to increment a header value (such as a Serial Number)
Hello all,
I am getting into Batch Runs for the first time and I was looking for a way to increase the Header Data (SN) for each part automatically. Opposed to manually entering it for each part as the batch runs. Is there a good VB script that can be added to the program to accomplish this? I found one online, but it keeps giving me script errors and I cannot figure out what the error is.
Edit: CMM Manager 2022
(Example)
' Declare variables
Dim currentSN, nextSN
' 1. Retrieve the current value from the Report Header
' Use GetReportInfo to pull existing data, such as "Serial Number"
currentSN = GetReportInfo("ReportHeader", "Serial Number")
' 2. Increment the value by 1
' Ensure the value is treated as a number before adding
nextSN = CInt(currentSN) + 1
' 3. Set the new value back into the Report Header for the current run
' Use application-specific commands to push variables to the header
SetReportInfo "ReportHeader", "Serial Number", nextSN
' Optional: Message box to verify the update
' MsgBox "Next Serial Number is: " & nextSN