6.1.2. Write the Script for the Add Blocks Button

  1. Declare a variable that's going to hold the item ID that the user enters.


Dim itemid As String

Dim model As String

  1. Create the input box that will prompt the user for an item ID and model type for the block.

itemid = InputBox$("Enter BLOCK item ID, please","Item ID Entry","")

model = InputBox$("Enter BLOCK model type, please (valid entries: 25,36,60,99)","Model Type Entry","")

  1. Take the value of the itemid string variable and create a new block item with the itemid string variable as the new block item's ID.

Declare a new object of type prtitem. Put this statement with your other variable declarations:

Dim item As New prtItem

  1. Add the code to add this new item to your schedule region.





item.exthold 0


item.inthold 0

'Add the item to PRT


  1. Compile your script.

  2. Close the Edit Script window.

  3. Close the Properties - Object dialog box.

More information