Showing results 1 to 2 of 2

Thread: Start a thread in VBA

  1. #1
    mrk Gast

    Default Start a thread in VBA

    Hi Folks!

    How can I start a thread with VBA.

    The problem is, when I write this code:

    thisProject.Tasks.Item(taskname).Run

    it doens't start.

    When i debug this request, there is also a mistake:

    Objectvariable or With-Blockvariable not declared
    what should i do?

    Please help!

    Yours, Mr.K

  2. #2

    Default Re: Start a PCE task VBA

    please see the VBA help on the correct usage of VBA in zenOn.

    The taskname must be passed as a string, meaning with "".

    Sub pce_stoptask()
    Dim myTask As Task
    Set myTask = thisProject.Tasks.Item("Task1")
    If (Not myTask Is Nothing) Then
       myTask.Stop
    End If
    End Sub
    
    
    Sub pce_starttask()
    Dim myTask As Task
    Set myTask = thisProject.Tasks.Item("Task1")
    If (Not myTask Is Nothing) Then
       myTask.Run
    End If
    End Sub

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •