Property let procedure not defined

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • Property let procedure not defined

    I'm having problem running some example VB code. It runs fine on another machine with VB. Just not mine. PC-DMIS is running in offline mode and the same program is loaded on each machine.

    Dim app As PCDLRN.Application
    Dim cmds As PCDLRN.Commands
    Dim cmd As PCDLRN.Command
    Dim part As PCDLRN.PartProgram
    Dim res As Boolean
    Dim cnt As Integer
    Dim str As String
    Dim fids As String

    Set app = CreateObject("PCDLRN.Application")
    Set part = app.ActivePartProgram
    Set cmds = part.Commands

    Open Text1.Text For Output As #1
    For Each cmd In cmds
    If cmd.IsDimension Then
    If cmd.DimensionCommand.Feat1 <> "" Then
    fids = "," + cmd.DimensionCommand.Feat1
    End If
    If cmd.DimensionCommand.Feat2 <> "" Then
    fids = fids + "," + cmd.DimensionCommand.Feat2
    End If
    If cmd.DimensionCommand.Feat3 <> "" Then
    fids = fids + "," + cmd.DimensionCommand.Feat3
    End If
    If cmd.Type <> DIMENSION_END_LOCATION And cmd.Type <> DIMENSION_START_LOCATION And cmd.Type <> DIMENSION_TRUE_START_POSITION And cmd.Type <> DIMENSION_TRUE_END_POSITION Then
    str = cmd.ID
    str = str + fids + GetNextString(cmd)
    Print #1, str
    fids = ""
    End If
    End If
    Next cmd


    I'm getting the following error at the "For Each cmd In cmds" line of code.

    Run-time error '451'

    Property let procedure not defined and property get procedure did not return and object.


    Anyone seen this before?

  • #2
    Nope...
    sigpic
    Xcel 15-20-10 - PFXcel 7-6-5 - Merlin 11-11-7 - Romer Absolute 7525SI
    PCDMIS 2012
    Windows Office XP

    Comment


    • #3
      Here's your program after some modifications to run under VB 2005 Express.

      Dim app As PCDLRN.Application
      Dim cmds As PCDLRN.Commands
      Dim cmd As PCDLRN.Command
      Dim part As PCDLRN.PartProgram
      Dim res As Boolean
      Dim cnt As Integer
      Dim cmdCnt As Integer
      Dim str As String
      Dim fids As String

      app = CreateObject("PCDLRN.Application")
      part = app.ActivePartProgram
      cmds = part.Commands

      'Open Text1.Text For Output As #1 Note: VB6 syntax
      FileOpen(1, "C:\Text1.txt", OpenMode.Output, OpenAccess.Default)

      cmdCnt = cmds.Count
      For i As Integer = 1 To cmdCnt
      'For Each cmd In cmds Note: cmds is not a Collections Object
      cmd = cmds.Item(i)
      If cmd.IsDimension Then
      If cmd.DimensionCommand.Feat1 <> "" Then
      fids = "," + cmd.DimensionCommand.Feat1
      End If
      If cmd.DimensionCommand.Feat2 <> "" Then
      fids = fids + "," + cmd.DimensionCommand.Feat2
      End If
      If cmd.DimensionCommand.Feat3 <> "" Then
      fids = fids + "," + cmd.DimensionCommand.Feat3
      End If
      If cmd.Type <> DIMENSION_END_LOCATION And cmd.Type <> DIMENSION_START_LOCATION And cmd.Type <> DIMENSION_TRUE_START_POSITION And cmd.Type <> DIMENSION_TRUE_END_POSITION Then
      str = cmd.ID
      'str = str + fids + GetNextString(cmd) Note: GetNextString doesn't exist - VB6 syntax?.
      str = str + fids
      'Print #1, str Note: VB6 syntax
      PrintLine(1, str)
      fids = ""
      End If
      End If
      Next
      'Next cmd
      FileClose(1)


      I commented out the lines that didn't work as written, put a note explaining why. The line before or after is a substitute that works. Wasn't sure what GetNextString(cmd) was trying to extract from the cmd object.

      My main observation is your statement 'For each cmd in cmds' didn't work for me because 'cmds' is not a Collections type object. Is is possible you have a different version VB runtime library on each of your machines?

      Comment

      Related Topics

      Collapse

      Working...
      X
      😀
      🥰
      🤢
      😎
      😡
      👍
      👎