hexagon logo

Help with OLE Automation

Now that I have information in a way that imports and exports the information correctly, I have been tasked with creating an OLE to automatically import the data into the SPC software. I have one that sort of works (as in opens the program, logs in, opens the right collection plan, etc) and I can get put in static information, but I am unsure how to call the information out of PC DMIS to have it be placed in the spots we need in the SPC software being used.

Has anyone else done this? Can anyone explain to me how find the variable and the measurement output in PC DMIS? I am using version 4.2 if that helps any.

Thanks so much.
Parents
  • If (ObjDimCmd.Type = DIMENSION_TRUE_END_POSITION) Then


    Maybe?

    Try
    If (ObjDimCmd.Type = DIMENSION_END_TRUE_POSITION) Then


    Thank you, that did get rid of the error there, but now I get one at the end of the sub. So here is the rest of the code. Again, I just am not sure why that error is there. As near as I can figure it thinks that it should do something else, but what?

    'Open WinSPC and Collection Plan
    Set dc = CreateObject("WinSPC.DataCollectionAuto")
    dc.Visible = True
    dc.RunHeadless = False
    While dc.ReadyForLogin = "F"
    Wend
    dc.UserName = "1675 CMM"
    dc.Password = "1675"
    
    	dc.CollectionPlanID = 8533
    	dc.TagIndex = 0
    	dc.TagValue = "P566290"
    	dc.TagIndex = 1
    	dc.TagValue = StrC2
    	dc.TagIndex = 2
    	dc.TagValue = StrC1
    	dc.CurrentStep = 0
    	dc.Value = MyReading1
    	dc.CurrentStep = 1
    	dc.Value = MyReading2
    	dc.CurrentStep = 2
    	dc.Value = MyReading3
    	dc.CurrentStep = 3
    	dc.Value = MyReading4
    	dc.CurrentStep = 4
    	dc.Value = MyReading5
    	dc.CurrentStep = 5
    	dc.Value = MyReading6
    	dc.CurrentStep = 6
    	dc.Value = MyReading7
    	dc.CurrentStep = 7
    	dc.Value = MyReading8
    	dc.CurrentStep = 8
    	dc.Value = MyReading9
    	dc.CurrentStep = 9
    	dc.Value = MyReading10
    	dc.CurrentStep = 10
    	dc.Value = MyReading11
    	dc.CurrentStep = 11
    	dc.Value = MyReading12
    	dc.CurrentStep = 12
    	dc.Value = MyReading13
    	dc.CurrentStep = 13
    	dc.Value = MyReading14
    	dc.CurrentStep = 14
    	dc.Value = MyReading15
    	dc.CurrentStep = 15
    	dc.Value = MyReading16
    	dc.CurrentStep = 16
    	dc.Value = MyReading17
    
    	dc.CollectionPlanID = 0
    	dc.UserName = ""
    	set dc = Nothing
    End Sub

    And the Next command between the variable If statements for the MyReading for the output is gone. It kept giving me an error if it was there.

    Any thoughts?
Reply
  • If (ObjDimCmd.Type = DIMENSION_TRUE_END_POSITION) Then


    Maybe?

    Try
    If (ObjDimCmd.Type = DIMENSION_END_TRUE_POSITION) Then


    Thank you, that did get rid of the error there, but now I get one at the end of the sub. So here is the rest of the code. Again, I just am not sure why that error is there. As near as I can figure it thinks that it should do something else, but what?

    'Open WinSPC and Collection Plan
    Set dc = CreateObject("WinSPC.DataCollectionAuto")
    dc.Visible = True
    dc.RunHeadless = False
    While dc.ReadyForLogin = "F"
    Wend
    dc.UserName = "1675 CMM"
    dc.Password = "1675"
    
    	dc.CollectionPlanID = 8533
    	dc.TagIndex = 0
    	dc.TagValue = "P566290"
    	dc.TagIndex = 1
    	dc.TagValue = StrC2
    	dc.TagIndex = 2
    	dc.TagValue = StrC1
    	dc.CurrentStep = 0
    	dc.Value = MyReading1
    	dc.CurrentStep = 1
    	dc.Value = MyReading2
    	dc.CurrentStep = 2
    	dc.Value = MyReading3
    	dc.CurrentStep = 3
    	dc.Value = MyReading4
    	dc.CurrentStep = 4
    	dc.Value = MyReading5
    	dc.CurrentStep = 5
    	dc.Value = MyReading6
    	dc.CurrentStep = 6
    	dc.Value = MyReading7
    	dc.CurrentStep = 7
    	dc.Value = MyReading8
    	dc.CurrentStep = 8
    	dc.Value = MyReading9
    	dc.CurrentStep = 9
    	dc.Value = MyReading10
    	dc.CurrentStep = 10
    	dc.Value = MyReading11
    	dc.CurrentStep = 11
    	dc.Value = MyReading12
    	dc.CurrentStep = 12
    	dc.Value = MyReading13
    	dc.CurrentStep = 13
    	dc.Value = MyReading14
    	dc.CurrentStep = 14
    	dc.Value = MyReading15
    	dc.CurrentStep = 15
    	dc.Value = MyReading16
    	dc.CurrentStep = 16
    	dc.Value = MyReading17
    
    	dc.CollectionPlanID = 0
    	dc.UserName = ""
    	set dc = Nothing
    End Sub

    And the Next command between the variable If statements for the MyReading for the output is gone. It kept giving me an error if it was there.

    Any thoughts?
Children
No Data