1

I'm writing a script in the VB to be used in excel, I'm using OLE to run a DXL script in DOORS. The DOORS script creates a popup window, which I'd like to give focus to when it's created.

Currently I have reference to the DOORS object, but I can't seem to find out how to set focus to the window. It might be that it's something that I have to do in the dxl, but I was wondering if there's a way to do this on the VB side of things.

So far I have:

Public Sub DoThing()
    Const DxlFilepath As String = "C:\FilePath"

    Dim DOORSObj As Object

    'Double check the user wants to do this
    vbCreateList = MsgBox("Current list will be lost. Please confirm to proceed? (Note: Parent folder must be selected in DOORS popup)", vbOKCancel, "Do thing")
    If (vbCreateList = vbCancel) Then
        Exit Sub
    End If

    'Get access to the DOORS application database
    Set DOORSObj = CreateObject("DOORS.Application")
    DOORSObj.result = "OK"
    DOORSObj.runFile (DxlFilepath)

End Sub

Thanks in advance

Community
  • 1
  • 1
J Lewis
  • 462
  • 1
  • 4
  • 15
  • If the DOORS object doesn't expose this functionality, it's likely that the only way to do this will be with API functions. Take a look at [How to locate the window using findwindow function in windowapi using vba?](http://stackoverflow.com/questions/34440961/how-to-locate-the-window-using-findwindow-function-in-windowapi-using-vba) and [SetFocus](https://msdn.microsoft.com/en-us/library/windows/desktop/ms646312(v=vs.85).aspx). – Comintern Jul 27 '16 at 12:41

0 Answers0