Problem in code is where the xlsht.Range("D" + Count) = Nominal
code starts. No matter what I put after the equal sign, I get an OLE error.
The other "xlsht.Range" commands in the code work fine.
Suggestions?
xlsht.Range("D" + Count) = Nominal
Sub Main 'Excel Declarations Dim xlApp As Object Dim xlwrkbks As Object Dim xlwrkbk As Object Dim xlsht As Object Dim Count As Integer 'PC-DMIS declarations Dim PCDApp As Object Set PCDApp = CreateObject("PCDLRN.Application") Dim Part As Object Set Part = PCDApp.ActivePartProgram Dim Cmds As Object Set Cmds = Part.Commands Dim Cmd As Object Dim DCmd As Object Dim CCmd As Object Dim DCmdID As String 'Variables From Part Program Dim VPART, VSERIALNUMBER, VPROGRAMID, VDATE, VTIME, VDESCRIPTION, VCMMOPERATOR, VLOCALCSV As Object Dim VREV As Object Set VREV = Part.GetVariableValue("VREV") Set VPART = Part.GetVariableValue("VPART") Set VDESCRIPTION = Part.GetVariableValue("VDESCRIPTION") Set VSERIALNUMBER = Part.GetVariableValue("VSERIALNUMBER") Set VPROGRAMID = Part.GetVariableValue("VPROGRAMID") Set VDATE = Part.GetVariableValue("VDATE") Set VTIME = Part.GetVariableValue("VTIME") Set VCMMOPERATOR = Part.GetVariableValue("VCMMOPERATOR") Set VLOCALCSV = Part.GetVariableValue("VLOCALCSV") 'Open Excel And Template File Set xlApp = CreateObject("Excel.Application") Set xlwrkbks = xlApp.Workbooks Set xlwrkbk = xlApp.Workbooks.Open("D:\CMM_PROGRAMS\PC-DMIS_SUPPORT_FILES\EXCEL_FILES\TEMPLATE.CSV") Set xlsht = xlwrkbk.Worksheets("TEMPLATE") 'EXCEL SHEET HEADER INFO xlsht.Range("A2").Value = "GE Aviation Batesville Composites Operation" xlsht.Range("A3").Value = "Part # :" xlsht.Range("A4").Value = "Date :" xlsht.Range("A5").Value = "Description :" xlsht.Range("A6").Value = "Serial # :" xlsht.Range("A7").Value = "Operator :" xlsht.Range("A8").Value = "Rev:" xlsht.Range("C3").Value = VPART.StringValue xlsht.Range("C4").Value = VDATE.StringValue xlsht.Range("C5").Value = VDESCRIPTION.StringValue xlsht.Range("C6").Value = VSERIALNUMBER.StringValue xlsht.Range("C7").Value = VCMMOPERATOR.StringValue xlsht.Range("C8").Value = VREV.StringValue xlsht.Range("A11").Value = "Dimension Name" xlsht.Range("D11").Value = "Nominal" xlsht.Range("E11").Value = "+TOL" xlsht.Range("F11").Value = "-TOL" xlsht.Range("G11").Value = "Measured" xlsht.Range("H11").Value = "MAX" xlsht.Range("I11").Value = "MIN" xlsht.Range("J11").Value = "Deviation" xlsht.Range("K11").Value = "OOT" xlsht.Range("L11").Value = "Bonus Tol" Count = Count + 1 For Each Cmd In Cmds If Cmd.IsDimension Then Set DCmd = Cmd.DimensionCommand Set DCmdID = DCmd.ID If Not DCmd.OutputMode = "None" Then xlsht.Range("D" + Count) = Nominal End If End If Next Cmd xlApp.Visible = True End Sub