Call VB Script

Post Reply
jswope
Super User
Super User
Posts: 176
Joined: Fri May 17, 2013 12:50 pm

Call VB Script

Post by jswope » Wed Apr 01, 2015 7:06 am

We have about 60 programs with the same VB Script in them. If we need to modify the script we need to go to every program to modify them. Is there a way to have the VB Script separate and then call it at the beginning of the program?

Thanks!
Jeff

Tabor
Super User
Super User
Posts: 175
Joined: Thu Dec 20, 2012 3:43 pm

Re: Call VB Script

Post by Tabor » Fri Apr 03, 2015 11:47 am

Save your script in a text file but change the extension to ".vbs" then put this in your program.

Code: Select all

Shell "wscript <filepath>\<filename>.vbs"
Tabor

mcasey
Frequent User
Frequent User
Posts: 35
Joined: Sat Jan 18, 2014 3:16 am

Re: Call VB Script

Post by mcasey » Fri May 25, 2018 10:56 am

Using the above information I can get CMM-M to start an external script, however it isn't reading the variables data generated by the script. When the CMM program gets to an operation that uses one of the variables it gives an error that the variable is undefined. I previously had the script in question running directly within the program and just copy/pasted to a .vbs file (using Notepad++). I've only been working with VB script for about a month now and am more or less self taught thanks to YouTube videos and online forums, so I'm guessing that it is something really minor that I'm missing. I've included the external script in case that would be helpful (apologies if my formatting is "questionable". I also redacted some folder names to XXXX and YYYY for privacy reasons)

Code: Select all

DIM OExcel
set OExcel=CreateObject("Excel.Application")
OExcel.visible = True
OExcel.Workbooks.Open("C:\Users\XXXX\Desktop\YYYY\Data\38999_Programming_Data.xls")

'Define variables
Dim Size
Dim Clocking
Dim AR
Dim BR
Dim CR
Dim DR
Dim Trans_AR 
Dim Trans_BR  
Dim Trans_CR 
Dim Trans_DR 
Dim BroachFree_Ang1 
Dim BroachFree_Ang2 
Dim BroachFree_Ang3 
Dim BroachFree_Ang4 
Dim BroachFree_Ang5 
Dim BroachFree_Plane_Rad
Dim BroachFree_Ang1_I
Dim BroachFree_Ang2_I
Dim BroachFree_Ang3_I
Dim BroachFree_Ang4_I
Dim BroachFree_Ang5_I
Dim BroachFree_Ang1_J
Dim BroachFree_Ang2_J
Dim BroachFree_Ang3_J
Dim BroachFree_Ang4_J
Dim BroachFree_Ang5_J
Dim Max_H_Dia
Dim Max_H_Rad
Dim Min_H_Dia
Dim Min_H_Rad
Dim Min_J_Dia
Dim Min_J_Rad
Dim Min_F_Dia
Dim Min_F_Rad
Dim Max_Br_Rel_Dia
Dim Max_Br_Rel_Rad
Dim Inr_Br_Dia
Dim Inr_Br_Rad
Dim Inr_Br_W
Dim Inr_Br_W_PT1
Dim Inr_Br_W_PT2
Dim MinorKeyway_PT1
Dim MinorKeyway_PT2
Dim Ins_Loc_Dia
Dim Ins_Loc_Rad
Dim Br_Ang
Dim Neg1
Dim Pos1
Dim Zero
Dim KeywayAR_Left_X
Dim KeywayAR_Left_Y
Dim KeywayAR_Left_I
Dim KeywayAR_Left_J
Dim KeywayAR_Right_X
Dim KeywayAR_Right_Y
Dim KeywayAR_Right_I
Dim KeywayAR_Right_J
Dim KeywayAR_Center_X
Dim KeywayAR_Center_Y

Dim KeywayBR_Left_X
Dim KeywayBR_Left_Y
Dim KeywayBR_Left_I
Dim KeywayBR_Left_J
Dim KeywayBR_Right_X
Dim KeywayBR_Right_Y
Dim KeywayBR_Right_I
Dim KeywayBR_Right_J

Dim KeywayCR_Left_X
Dim KeywayCR_Left_Y
Dim KeywayCR_Left_I
Dim KeywayCR_Left_J
Dim KeywayCR_Right_X
Dim KeywayCR_Right_Y
Dim KeywayCR_Right_I
Dim KeywayCR_Right_J

Dim KeywayDR_Left_X
Dim KeywayDR_Left_Y
Dim KeywayDR_Left_I
Dim KeywayDR_Left_J
Dim KeywayDR_Right_X
Dim KeywayDR_Right_Y
Dim KeywayDR_Right_I
Dim KeywayDR_Right_J



'User Inputs
Size = InputBox("Shell Size:")		
Clocking = InputBox("Clocking:")


'Logic Statements

	'Size Logic
If Size = 9 then
	Max_H_Dia = OExcel.Sheets(2).Cells(2,2).value
	Max_H_Rad = Max_H_Dia/2
	Min_H_Dia = OExcel.Sheets(2).Cells(2,3).value
	Min_H_Rad = Min_H_Dia/2
	Min_J_Dia = OExcel.Sheets(2).Cells(2,5).value
	Min_J_Rad = Min_J_Dia/2
	Min_F_Dia = OExcel.Sheets(2).Cells(2,7).value
	Min_F_Rad = Min_F_Dia/2
	Max_Br_Rel_Dia_Dia = OExcel.Sheets(2).Cells(2,8).value
	Inr_Br_Dia = OExcel.Sheets(2).Cells(2,10).value
	Inr_Br_Rad = Inr_Br_Dia/2
	Inr_Br_W = OExcel.Sheets(2).Cells(2,9).value
	Ins_Loc_Dia = OExcel.Sheets(2).Cells(2,11).value
	Ins_Loc_Rad = Ins_Loc_Dia/2
ElseIf Size = 11 then
	Max_H_Dia = OExcel.Sheets(2).Cells(3,2).value
	Max_H_Rad = Max_H_Dia/2
	Min_H_Dia = OExcel.Sheets(2).Cells(3,3).value
	Min_H_Rad = Min_H_Dia/2
	Min_J_Dia = OExcel.Sheets(2).Cells(3,5).value
	Min_J_Rad = Min_J_Dia/2
	Min_F_Dia = OExcel.Sheets(2).Cells(3,7).value
	Min_F_Rad = Min_F_Dia/2
	Max_Br_Rel_Dia = OExcel.Sheets(2).Cells(3,8).value
	Inr_Br_Dia = OExcel.Sheets(2).Cells(3,10).value
	Inr_Br_Rad = Inr_Br_Dia/2
	Inr_Br_W = OExcel.Sheets(2).Cells(3,9).value
	Ins_Loc_Dia = OExcel.Sheets(2).Cells(3,11).value
	Ins_Loc_Rad = Ins_Loc_Dia/2
ElseIf Size = 13 then
	Max_H_Dia = OExcel.Sheets(2).Cells(4,2).value
	Max_H_Rad = Max_H_Dia/2
	Min_H_Dia = OExcel.Sheets(2).Cells(4,3).value
	Min_H_Rad = Min_H_Dia/2
	Min_J_Dia = OExcel.Sheets(2).Cells(4,5).value
	Min_J_Rad = Min_J_Dia/2
	Min_F_Dia = OExcel.Sheets(2).Cells(4,7).value
	Min_F_Rad = Min_F_Dia/2
	Max_Br_Rel_Dia = OExcel.Sheets(2).Cells(4,8).value
	Inr_Br_Dia = OExcel.Sheets(2).Cells(4,10).value
	Inr_Br_Rad = Inr_Br_Dia/2
	Inr_Br_W = OExcel.Sheets(2).Cells(4,9).value
	Ins_Loc_Dia = OExcel.Sheets(2).Cells(4,11).value
	Ins_Loc_Rad = Ins_Loc_Dia/2
ElseIf Size = 15 then
	Max_H_Dia = OExcel.Sheets(2).Cells(5,2).value
	Max_H_Rad = Max_H_Dia/2
	Min_H_Dia = OExcel.Sheets(2).Cells(5,3).value
	Min_H_Rad = Min_H_Dia/2
	Min_J_Dia = OExcel.Sheets(2).Cells(5,5).value
	Min_J_Rad = Min_J_Dia/2
	Min_F_Dia = OExcel.Sheets(2).Cells(5,7).value
	Min_F_Rad = Min_F_Dia/2
	Max_Br_Rel_Dia = OExcel.Sheets(2).Cells(5,8).value
	Inr_Br_Dia = OExcel.Sheets(2).Cells(5,10).value
	Inr_Br_Rad = Inr_Br_Dia/2
	Inr_Br_W = OExcel.Sheets(2).Cells(5,9).value
	Ins_Loc_Dia = OExcel.Sheets(2).Cells(5,11).value
	Ins_Loc_Rad = Ins_Loc_Dia/2
ElseIf Size = 17 then
	Max_H_Dia = OExcel.Sheets(2).Cells(6,2).value
	Max_H_Rad = Max_H_Dia/2
	Min_H_Dia = OExcel.Sheets(2).Cells(6,3).value
	Min_H_Rad = Min_H_Dia/2
	Min_J_Dia = OExcel.Sheets(2).Cells(6,5).value
	Min_J_Rad = Min_J_Dia/2
	Min_F_Dia = OExcel.Sheets(2).Cells(6,7).value
	Min_F_Rad = Min_F_Dia/2
	Max_Br_Rel_Dia = OExcel.Sheets(2).Cells(6,8).value
	Inr_Br_Dia = OExcel.Sheets(2).Cells(6,10).value
	Inr_Br_Rad = Inr_Br_Dia/2
	Inr_Br_W = OExcel.Sheets(2).Cells(6,9).value
	Ins_Loc_Dia = OExcel.Sheets(2).Cells(6,11).value
	Ins_Loc_Rad = Ins_Loc_Dia/2
ElseIf Size = 19 then
	Max_H_Dia = OExcel.Sheets(2).Cells(7,2).value
	Max_H_Rad = Max_H_Dia/2
	Min_H_Dia = OExcel.Sheets(2).Cells(7,3).value
	Min_H_Rad = Min_H_Dia/2
	Min_J_Dia = OExcel.Sheets(2).Cells(7,5).value
	Min_J_Rad = Min_J_Dia/2
	Min_F_Dia = OExcel.Sheets(2).Cells(7,7).value
	Min_F_Rad = Min_F_Dia/2
	Max_Br_Rel_Dia = OExcel.Sheets(2).Cells(7,8).value
	Inr_Br_Dia = OExcel.Sheets(2).Cells(7,10).value
	Inr_Br_Rad = Inr_Br_Dia/2
	Inr_Br_W = OExcel.Sheets(2).Cells(7,9).value
	Ins_Loc_Dia = OExcel.Sheets(2).Cells(7,11).value
	Ins_Loc_Rad = Ins_Loc_Dia/2
ElseIf Size = 21 then
	Max_H_Dia = OExcel.Sheets(2).Cells(8,2).value
	Max_H_Rad = Max_H_Dia/2
	Min_H_Dia = OExcel.Sheets(2).Cells(8,3).value
	Min_H_Rad = Min_H_Dia/2
	Min_J_Dia = OExcel.Sheets(2).Cells(8,5).value
	Min_J_Rad = Min_J_Dia/2
	Min_F_Dia = OExcel.Sheets(2).Cells(8,7).value
	Min_F_Rad = Min_F_Dia/2
	Max_Br_Rel_Dia = OExcel.Sheets(2).Cells(8,8).value
	Inr_Br_Dia = OExcel.Sheets(2).Cells(8,10).value
	Inr_Br_Rad = Inr_Br_Dia/2
	Inr_Br_W = OExcel.Sheets(2).Cells(8,9).value
	Ins_Loc_Dia = OExcel.Sheets(2).Cells(8,11).value
	Ins_Loc_Rad = Ins_Loc_Dia/2
ElseIf Size = 23 then
	Max_H_Dia = OExcel.Sheets(2).Cells(9,2).value
	Max_H_Rad = Max_H_Dia/2
	Min_H_Dia = OExcel.Sheets(2).Cells(9,3).value
	Min_H_Rad = Min_H_Dia/2
	Min_J_Dia = OExcel.Sheets(2).Cells(9,5).value
	Min_J_Rad = Min_J_Dia/2
	Min_F_Dia = OExcel.Sheets(2).Cells(9,7).value
	Min_F_Rad = Min_F_Dia/2
	Max_Br_Rel_Dia = OExcel.Sheets(2).Cells(9,8).value
	Inr_Br_Dia = OExcel.Sheets(2).Cells(9,10).value
	Inr_Br_Rad = Inr_Br_Dia/2
	Inr_Br_W = OExcel.Sheets(2).Cells(9,9).value
	Ins_Loc_Dia = OExcel.Sheets(2).Cells(9,11).value
	Ins_Loc_Rad = Ins_Loc_Dia/2
ElseIf Size = 25 then
	Max_H_Dia = OExcel.Sheets(2).Cells(10,2).value
	Max_H_Rad = Max_H_Dia/2
	Min_H_Dia = OExcel.Sheets(2).Cells(10,3).value
	Min_H_Rad = Min_H_Dia/2
	Min_J_Dia = OExcel.Sheets(2).Cells(10,5).value
	Min_J_Rad = Min_J_Dia/2
	Min_F_Dia = OExcel.Sheets(2).Cells(10,7).value
	Min_F_Rad = Min_F_Dia/2
	Max_Br_Rel_Dia = OExcel.Sheets(2).Cells(10,8).value
	Inr_Br_Dia = OExcel.Sheets(2).Cells(10,10).value
	Inr_Br_Rad = Inr_Br_Dia/2
	Inr_Br_W = OExcel.Sheets(2).Cells(10,9).value
	Ins_Loc_Dia = OExcel.Sheets(2).Cells(10,11).value
	Ins_Loc_Rad = Ins_Loc_Dia/2
Else 
		Wscript.Echo "", "Inavlid Size.", vbCr, "", "Please Enter A Valid Shell Size (9, 11, 13, 15, 17, 19, 21, 23, or 25)."
End If


	'Clocking Logic
If Size = 9 then
	If Clocking = "N" or Clocking = "n" then
		AR = OExcel.Sheets(1).Cells(2,3).value
		BR = OExcel.Sheets(1).Cells(2,4).value
		CR = OExcel.Sheets(1).Cells(2,5).value
		DR = OExcel.Sheets(1).Cells(2,6).value
	ElseIf Clocking = "A" or Clocking = "a" then
		AR = OExcel.Sheets(1).Cells(3,3).value
		BR = OExcel.Sheets(1).Cells(3,4).value
		CR = OExcel.Sheets(1).Cells(3,5).value
		DR = OExcel.Sheets(1).Cells(3,6).value
	ElseIf Clocking = "B" or Clocking = "b" then
		AR = OExcel.Sheets(1).Cells(4,3).value
		BR = OExcel.Sheets(1).Cells(4,4).value
		CR = OExcel.Sheets(1).Cells(4,5).value
		DR = OExcel.Sheets(1).Cells(4,6).value
	ElseIf Clocking = "C" or Clocking = "c" then 
		AR = OExcel.Sheets(1).Cells(5,3).value
		BR = OExcel.Sheets(1).Cells(5,4).value
		CR = OExcel.Sheets(1).Cells(5,5).value
		DR = OExcel.Sheets(1).Cells(5,6).value
	ElseIf Clocking = "D" or Clocking = "d" then
		AR = OExcel.Sheets(1).Cells(6,3).value
		BR = OExcel.Sheets(1).Cells(6,4).value
		CR = OExcel.Sheets(1).Cells(6,5).value
		DR = OExcel.Sheets(1).Cells(6,6).value
	ElseIf Clocking = "E" or Clocking = "e" then
		AR = OExcel.Sheets(1).Cells(7,3).value
		BR = OExcel.Sheets(1).Cells(7,4).value
		CR = OExcel.Sheets(1).Cells(7,5).value
		DR = OExcel.Sheets(1).Cells(7,6).value
	Else 
		Wscript.Echo "", "Inavlid Clocking.", vbCr, "", "Please Enter A Valid Clocking (N, A, B, C, D, or E)."
	End If
ElseIf Size = 11 then
	If Clocking = "N" or Clocking = "n" then
		AR = OExcel.Sheets(1).Cells(8,3).value
		BR = OExcel.Sheets(1).Cells(8,4).value
		CR = OExcel.Sheets(1).Cells(8,5).value
		DR = OExcel.Sheets(1).Cells(8,6).value
	ElseIf Clocking = "A" or Clocking = "a" then
		AR = OExcel.Sheets(1).Cells(9,3).value
		BR = OExcel.Sheets(1).Cells(9,4).value
		CR = OExcel.Sheets(1).Cells(9,5).value
		DR = OExcel.Sheets(1).Cells(9,6).value
	ElseIf Clocking = "B" or Clocking = "b" then
		AR = OExcel.Sheets(1).Cells(10,3).value
		BR = OExcel.Sheets(1).Cells(10,4).value
		CR = OExcel.Sheets(1).Cells(10,5).value
		DR = OExcel.Sheets(1).Cells(10,6).value
	ElseIf Clocking = "C" or Clocking = "c" then 
		AR = OExcel.Sheets(1).Cells(11,3).value
		BR = OExcel.Sheets(1).Cells(11,4).value
		CR = OExcel.Sheets(1).Cells(11,5).value
		DR = OExcel.Sheets(1).Cells(11,6).value
	ElseIf Clocking = "D" or Clocking = "d" then
		AR = OExcel.Sheets(1).Cells(12,3).value
		BR = OExcel.Sheets(1).Cells(12,4).value
		CR = OExcel.Sheets(1).Cells(12,5).value
		DR = OExcel.Sheets(1).Cells(12,6).value
	ElseIf Clocking = "E" or Clocking = "e" then
		AR = OExcel.Sheets(1).Cells(13,3).value
		BR = OExcel.Sheets(1).Cells(13,4).value
		CR = OExcel.Sheets(1).Cells(13,5).value
		DR = OExcel.Sheets(1).Cells(13,6).value
	Else 
		Wscript.Echo "", "Inavlid Clocking.", vbCr, "", "Please Enter A Valid Clocking (N, A, B, C, D, or E)."
	End If
ElseIf Size = 13 then
	If Clocking = "N" or Clocking = "n" then
		AR = OExcel.Sheets(1).Cells(8,3).value
		BR = OExcel.Sheets(1).Cells(8,4).value
		CR = OExcel.Sheets(1).Cells(8,5).value
		DR = OExcel.Sheets(1).Cells(8,6).value
	ElseIf Clocking = "A" or Clocking = "a" then
		AR = OExcel.Sheets(1).Cells(9,3).value
		BR = OExcel.Sheets(1).Cells(9,4).value
		CR = OExcel.Sheets(1).Cells(9,5).value
		DR = OExcel.Sheets(1).Cells(9,6).value
	ElseIf Clocking = "B" or Clocking = "b" then
		AR = OExcel.Sheets(1).Cells(10,3).value
		BR = OExcel.Sheets(1).Cells(10,4).value
		CR = OExcel.Sheets(1).Cells(10,5).value
		DR = OExcel.Sheets(1).Cells(10,6).value
	ElseIf Clocking = "C" or Clocking = "c" then 
		AR = OExcel.Sheets(1).Cells(11,3).value
		BR = OExcel.Sheets(1).Cells(11,4).value
		CR = OExcel.Sheets(1).Cells(11,5).value
		DR = OExcel.Sheets(1).Cells(11,6).value
	ElseIf Clocking = "D" or Clocking = "d" then
		AR = OExcel.Sheets(1).Cells(12,3).value
		BR = OExcel.Sheets(1).Cells(12,4).value
		CR = OExcel.Sheets(1).Cells(12,5).value
		DR = OExcel.Sheets(1).Cells(12,6).value
	ElseIf Clocking = "E" or Clocking = "e" then
		AR = OExcel.Sheets(1).Cells(13,3).value
		BR = OExcel.Sheets(1).Cells(13,4).value
		CR = OExcel.Sheets(1).Cells(13,5).value
		DR = OExcel.Sheets(1).Cells(13,6).value
	Else 
		Wscript.Echo "", "Inavlid Clocking.", vbCr, "", "Please Enter A Valid Clocking (N, A, B, C, D, or E)."
	End If
ElseIf Size = 15 then
	If Clocking = "N" or Clocking = "n" then
		AR = OExcel.Sheets(1).Cells(8,3).value
		BR = OExcel.Sheets(1).Cells(8,4).value
		CR = OExcel.Sheets(1).Cells(8,5).value
		DR = OExcel.Sheets(1).Cells(8,6).value
	ElseIf Clocking = "A" or Clocking = "a" then
		AR = OExcel.Sheets(1).Cells(9,3).value
		BR = OExcel.Sheets(1).Cells(9,4).value
		CR = OExcel.Sheets(1).Cells(9,5).value
		DR = OExcel.Sheets(1).Cells(9,6).value
	ElseIf Clocking = "B" or Clocking = "b" then
		AR = OExcel.Sheets(1).Cells(10,3).value
		BR = OExcel.Sheets(1).Cells(10,4).value
		CR = OExcel.Sheets(1).Cells(10,5).value
		DR = OExcel.Sheets(1).Cells(10,6).value
	ElseIf Clocking = "C" or Clocking = "c" then 
		AR = OExcel.Sheets(1).Cells(11,3).value
		BR = OExcel.Sheets(1).Cells(11,4).value
		CR = OExcel.Sheets(1).Cells(11,5).value
		DR = OExcel.Sheets(1).Cells(11,6).value
	ElseIf Clocking = "D" or Clocking = "d" then
		AR = OExcel.Sheets(1).Cells(12,3).value
		BR = OExcel.Sheets(1).Cells(12,4).value
		CR = OExcel.Sheets(1).Cells(12,5).value
		DR = OExcel.Sheets(1).Cells(12,6).value
	ElseIf Clocking = "E" or Clocking = "e" then
		AR = OExcel.Sheets(1).Cells(13,3).value
		BR = OExcel.Sheets(1).Cells(13,4).value
		CR = OExcel.Sheets(1).Cells(13,5).value
		DR = OExcel.Sheets(1).Cells(13,6).value
	Else 
		Wscript.Echo "", "Inavlid Clocking.", vbCr, "", "Please Enter A Valid Clocking (N, A, B, C, D, or E)."
	End If
ElseIf Size = 17 then
	If Clocking = "N" or Clocking = "n" then
		AR = OExcel.Sheets(1).Cells(14,3).value
		BR = OExcel.Sheets(1).Cells(14,4).value
		CR = OExcel.Sheets(1).Cells(14,5).value
		DR = OExcel.Sheets(1).Cells(14,6).value
	ElseIf Clocking = "A" or Clocking = "a" then
		AR = OExcel.Sheets(1).Cells(15,3).value
		BR = OExcel.Sheets(1).Cells(15,4).value
		CR = OExcel.Sheets(1).Cells(15,5).value
		DR = OExcel.Sheets(1).Cells(15,6).value
	ElseIf Clocking = "B" or Clocking = "b" then
		AR = OExcel.Sheets(1).Cells(16,3).value
		BR = OExcel.Sheets(1).Cells(16,4).value
		CR = OExcel.Sheets(1).Cells(16,5).value
		DR = OExcel.Sheets(1).Cells(16,6).value
	ElseIf Clocking = "C" or Clocking = "c" then 
		AR = OExcel.Sheets(1).Cells(17,3).value
		BR = OExcel.Sheets(1).Cells(17,4).value
		CR = OExcel.Sheets(1).Cells(17,5).value
		DR = OExcel.Sheets(1).Cells(17,6).value
	ElseIf Clocking = "D" or Clocking = "d" then
		AR = OExcel.Sheets(1).Cells(18,3).value
		BR = OExcel.Sheets(1).Cells(18,4).value
		CR = OExcel.Sheets(1).Cells(18,5).value
		DR = OExcel.Sheets(1).Cells(18,6).value
	ElseIf Clocking = "E" or Clocking = "e" then
		AR = OExcel.Sheets(1).Cells(19,3).value
		BR = OExcel.Sheets(1).Cells(19,4).value
		CR = OExcel.Sheets(1).Cells(19,5).value
		DR = OExcel.Sheets(1).Cells(19,6).value
	Else 
		Wscript.Echo "", "Inavlid Clocking.", vbCr, "", "Please Enter A Valid Clocking (N, A, B, C, D, or E)."
	End If
ElseIf Size = 19 then
	If Clocking = "N" or Clocking = "n" then
		AR = OExcel.Sheets(1).Cells(14,3).value
		BR = OExcel.Sheets(1).Cells(14,4).value
		CR = OExcel.Sheets(1).Cells(14,5).value
		DR = OExcel.Sheets(1).Cells(14,6).value
	ElseIf Clocking = "A" or Clocking = "a" then
		AR = OExcel.Sheets(1).Cells(15,3).value
		BR = OExcel.Sheets(1).Cells(15,4).value
		CR = OExcel.Sheets(1).Cells(15,5).value
		DR = OExcel.Sheets(1).Cells(15,6).value
	ElseIf Clocking = "B" or Clocking = "b" then
		AR = OExcel.Sheets(1).Cells(16,3).value
		BR = OExcel.Sheets(1).Cells(16,4).value
		CR = OExcel.Sheets(1).Cells(16,5).value
		DR = OExcel.Sheets(1).Cells(16,6).value
	ElseIf Clocking = "C" or Clocking = "c" then 
		AR = OExcel.Sheets(1).Cells(17,3).value
		BR = OExcel.Sheets(1).Cells(17,4).value
		CR = OExcel.Sheets(1).Cells(17,5).value
		DR = OExcel.Sheets(1).Cells(17,6).value
	ElseIf Clocking = "D" or Clocking = "d" then
		AR = OExcel.Sheets(1).Cells(18,3).value
		BR = OExcel.Sheets(1).Cells(18,4).value
		CR = OExcel.Sheets(1).Cells(18,5).value
		DR = OExcel.Sheets(1).Cells(18,6).value
	ElseIf Clocking = "E" or Clocking = "e" then
		AR = OExcel.Sheets(1).Cells(19,3).value
		BR = OExcel.Sheets(1).Cells(19,4).value
		CR = OExcel.Sheets(1).Cells(19,5).value
		DR = OExcel.Sheets(1).Cells(19,6).value
	Else 
		Wscript.Echo "", "Inavlid Clocking.", vbCr, "", "Please Enter A Valid Clocking (N, A, B, C, D, or E)."
	End If
ElseIf Size = 21 then
	If Clocking = "N" or Clocking = "n" then
		AR = OExcel.Sheets(1).Cells(14,3).value
		BR = OExcel.Sheets(1).Cells(14,4).value
		CR = OExcel.Sheets(1).Cells(14,5).value
		DR = OExcel.Sheets(1).Cells(14,6).value
	ElseIf Clocking = "A" or Clocking = "a" then
		AR = OExcel.Sheets(1).Cells(15,3).value
		BR = OExcel.Sheets(1).Cells(15,4).value
		CR = OExcel.Sheets(1).Cells(15,5).value
		DR = OExcel.Sheets(1).Cells(15,6).value
	ElseIf Clocking = "B" or Clocking = "b" then
		AR = OExcel.Sheets(1).Cells(16,3).value
		BR = OExcel.Sheets(1).Cells(16,4).value
		CR = OExcel.Sheets(1).Cells(16,5).value
		DR = OExcel.Sheets(1).Cells(16,6).value
	ElseIf Clocking = "C" or Clocking = "c" then 
		AR = OExcel.Sheets(1).Cells(17,3).value
		BR = OExcel.Sheets(1).Cells(17,4).value
		CR = OExcel.Sheets(1).Cells(17,5).value
		DR = OExcel.Sheets(1).Cells(17,6).value
	ElseIf Clocking = "D" or Clocking = "d" then
		AR = OExcel.Sheets(1).Cells(18,3).value
		BR = OExcel.Sheets(1).Cells(18,4).value
		CR = OExcel.Sheets(1).Cells(18,5).value
		DR = OExcel.Sheets(1).Cells(18,6).value
	ElseIf Clocking = "E" or Clocking = "e" then
		AR = OExcel.Sheets(1).Cells(19,3).value
		BR = OExcel.Sheets(1).Cells(19,4).value
		CR = OExcel.Sheets(1).Cells(19,5).value
		DR = OExcel.Sheets(1).Cells(19,6).value
	Else 
		Wscript.Echo "", "Inavlid Clocking.", vbCr, "", "Please Enter A Valid Clocking (N, A, B, C, D, or E)."
	End If
ElseIf Size = 23 then
	If Clocking = "N" or Clocking = "n" then
		AR = OExcel.Sheets(1).Cells(14,3).value
		BR = OExcel.Sheets(1).Cells(14,4).value
		CR = OExcel.Sheets(1).Cells(14,5).value
		DR = OExcel.Sheets(1).Cells(14,6).value
	ElseIf Clocking = "A" or Clocking = "a" then
		AR = OExcel.Sheets(1).Cells(15,3).value
		BR = OExcel.Sheets(1).Cells(15,4).value
		CR = OExcel.Sheets(1).Cells(15,5).value
		DR = OExcel.Sheets(1).Cells(15,6).value
	ElseIf Clocking = "B" or Clocking = "b" then
		AR = OExcel.Sheets(1).Cells(16,3).value
		BR = OExcel.Sheets(1).Cells(16,4).value
		CR = OExcel.Sheets(1).Cells(16,5).value
		DR = OExcel.Sheets(1).Cells(16,6).value
	ElseIf Clocking = "C" or Clocking = "c" then 
		AR = OExcel.Sheets(1).Cells(17,3).value
		BR = OExcel.Sheets(1).Cells(17,4).value
		CR = OExcel.Sheets(1).Cells(17,5).value
		DR = OExcel.Sheets(1).Cells(17,6).value
	ElseIf Clocking = "D" or Clocking = "d" then
		AR = OExcel.Sheets(1).Cells(18,3).value
		BR = OExcel.Sheets(1).Cells(18,4).value
		CR = OExcel.Sheets(1).Cells(18,5).value
		DR = OExcel.Sheets(1).Cells(18,6).value
	ElseIf Clocking = "E" or Clocking = "e" then
		AR = OExcel.Sheets(1).Cells(19,3).value
		BR = OExcel.Sheets(1).Cells(19,4).value
		CR = OExcel.Sheets(1).Cells(19,5).value
		DR = OExcel.Sheets(1).Cells(19,6).value
	Else 
		Wscript.Echo "", "Inavlid Clocking.", vbCr, "", "Please Enter A Valid Clocking (N, A, B, C, D, or E)."
	End If
ElseIf Size = 25 then
	If Clocking = "N" or Clocking = "n" then
		AR = OExcel.Sheets(1).Cells(14,3).value
		BR = OExcel.Sheets(1).Cells(14,4).value
		CR = OExcel.Sheets(1).Cells(14,5).value
		DR = OExcel.Sheets(1).Cells(14,6).value
	ElseIf Clocking = "A" or Clocking = "a" then
		AR = OExcel.Sheets(1).Cells(15,3).value
		BR = OExcel.Sheets(1).Cells(15,4).value
		CR = OExcel.Sheets(1).Cells(15,5).value
		DR = OExcel.Sheets(1).Cells(15,6).value
	ElseIf Clocking = "B" or Clocking = "b" then
		AR = OExcel.Sheets(1).Cells(16,3).value
		BR = OExcel.Sheets(1).Cells(16,4).value
		CR = OExcel.Sheets(1).Cells(16,5).value
		DR = OExcel.Sheets(1).Cells(16,6).value
	ElseIf Clocking = "C" or Clocking = "c" then 
		AR = OExcel.Sheets(1).Cells(17,3).value
		BR = OExcel.Sheets(1).Cells(17,4).value
		CR = OExcel.Sheets(1).Cells(17,5).value
		DR = OExcel.Sheets(1).Cells(17,6).value
	ElseIf Clocking = "D" or Clocking = "d" then
		AR = OExcel.Sheets(1).Cells(18,3).value
		BR = OExcel.Sheets(1).Cells(18,4).value
		CR = OExcel.Sheets(1).Cells(18,5).value
		DR = OExcel.Sheets(1).Cells(18,6).value
	ElseIf Clocking = "E" or Clocking = "e" then
		AR = OExcel.Sheets(1).Cells(19,3).value
		BR = OExcel.Sheets(1).Cells(19,4).value
		CR = OExcel.Sheets(1).Cells(19,5).value
		DR = OExcel.Sheets(1).Cells(19,6).value
	Else 
		Wscript.Echo "", "Inavlid Clocking.", vbCr, "", "Please Enter A Valid Clocking (N, A, B, C, D, or E)."
	End If
Else 
		Wscript.Echo "", "Inavlid Size.", vbCr, "", "Please Enter A Valid Shell Size (9, 11, 13, 15, 17, 19, 21, 23, or 25)."
End If


'Computations
Trans_AR = AR
Trans_BR = BR - AR
Trans_CR = CR - BR
Trans_DR = DR - CR
BroachFree_Ang1 = (Trans_AR/2) + 90
BroachFree_Ang1_I = Cos((180 + BroachFree_Ang1) * (3.14159 / 180))
BroachFree_Ang1_J = Sin((180 + BroachFree_Ang1) * (3.14159 / 180))
BroachFree_Ang2 = (Trans_AR + Trans_BR/2) + 90
BroachFree_Ang2_I = Cos((180 + BroachFree_Ang2) * (3.14159 / 180))
BroachFree_Ang2_J = Sin((180 + BroachFree_Ang2) * (3.14159 / 180))
BroachFree_Ang3 = (Trans_AR + Trans_BR + Trans_CR/2) + 90
BroachFree_Ang3_I = Cos((180 + BroachFree_Ang3) * (3.14159 / 180))
BroachFree_Ang3_J = Sin((180 + BroachFree_Ang3) * (3.14159 / 180))
BroachFree_Ang4 = (Trans_AR + Trans_BR + Trans_CR + Trans_DR/2) + 90
BroachFree_Ang4_I = Cos((180 + BroachFree_Ang4) * (3.14159 / 180))
BroachFree_Ang4_J = Sin((180 + BroachFree_Ang4) * (3.14159 / 180))
BroachFree_Ang5 = (Trans_AR + Trans_BR + Trans_CR + Trans_DR + (360 - (Trans_AR + Trans_BR + Trans_CR + Trans_DR))/2) - 270
BroachFree_Ang5_I = Cos((180 + BroachFree_Ang5) * (3.14159 / 180))
BroachFree_Ang5_J = Sin((180 + BroachFree_Ang5) * (3.14159 / 180))
BroachFree_Plane_Rad = ((Min_F_Rad - Max_H_Rad)/2) + Max_H_Rad

Inr_Br_W_PT1 = Inr_Br_W/(-2)
Inr_Br_W_PT2 = Inr_Br_W/2
MinorKeyway_PT1 = -.03125
MinorKeyway_PT2 = .03125
Max_Br_Rel_Rad = Max_Br_Rel_Dia/2
Br_Ang = 90
Neg1 = -1
Pos1 = 1
Zero = 0

OExcel.Quit

Post Reply