Engineering Requirements Management

Engineering Requirements Management

Come for answers, stay for best practices. All we're missing is you.

 View Only
  • 1.  oleAutoObj not opening an excel application

    Posted Sun October 11, 2020 01:16 AM

    Hi All,

    Following code is not opening an excel application in my PC.

    OleAutoObj objExcel = oleCreateAutoObject("Excel.Application")

    if (objExcel != null){

    bool excelVisible

    oleGet(objExcel, "Visible", excelVisible)

    if (excelVisible == false){

    olePut(objExcel, "Visible", true)

    }

    }

    Any idea why it is not opening excel application?

    Any help will be greatly appreciated.

    -Ashok Anumula





    #SupportMigration
    #Support
    #EngineeringRequirementsManagement
    #DOORS
    #Sustainability


  • 2.  RE: oleAutoObj not opening an excel application

    Posted Mon October 12, 2020 12:22 PM

    Hi Ashok,

    I would try to eliminate some external factors first:

    • does Excel launch manually?
    • does Excel launch during DOORS 9 client -> Excel export?
    • is the path behind the executable registered in Windows registry to the Excel.Application object correct?
    • do other applications launch Excel okay when you create an Excel.Application object (e.g. via VBA from Word)




    #DOORS
    #Sustainability
    #SupportMigration
    #Support
    #EngineeringRequirementsManagement


  • 3.  RE: oleAutoObj not opening an excel application

    Posted Thu October 15, 2020 04:25 AM

    Schubert. Thank you for your reply.

    Yes.

    -Excel launches manually

    -Excel export from DOORS working

    -I am able to open Excel.Application from WORD VBA with following code:

    ---------------------------

    Sub exop()

    Dim excelApp As Excel.Application

    Dim openExcel As Workbook

    Set excelApp = New Excel.Application

    Set openExcel = excelApp.Workbooks.Open("C:\Ashok\file.xlsx")

    excelApp.Visible = True

    End Sub

    ----------------------------

    Please let me know how to check following.

    • is the path behind the executable registered in Windows registry to the Excel.Application object correct?

    Excel.Application is not working from DOORS dxl script.

    I suspect a script which I ran earlier. After that Excel.Application is not working. Script deals with oleObjects. I guess it opened oleExcel objects.

    Here is that script.

    --------------------------------------------------------

    string s = "/Training Car Project/System requirements"

    Module m = read(s, false)

    OleAutoObj wbs

    OleAutoObj wb

    OleAutoObj ws

    OleAutoObj objCell

    OleAutoArgs args = create// create an excel

    OleAutoObj ex = oleCreateAutoObject "Excel.Application"

    oleGet (ex, "Workbooks", wbs) // get workbooks handle

    oleMethod (wbs, "Add", args, wb)// add a workbook

    olePut(ex, "Visible", true)// make excel visible

    put(args, 1)// Get first worksheet

    oleGet (ex, "Worksheets", args, ws) // your code now

    Object o

    int i = 1

    int j = 3

    for o in m do

    {

    if (oleIsObject (o))

    {

    oleActivate(o)

    i = i + 20

    string s = richTextWithOle (o."Object Text")

    RichText rtf

    for rtf in s do

    {

    if (rtf.isOle)

    {

    print o."Absolute Number""\n"

    EmbeddedOleObject ole = rtf.getEmbeddedOle

    oleCopy (ole)

    clear args

    put (args, i)

    put (args, j)

    oleGet (ws, "Cells", args, objCell) // select cell

    clear args

    put (args, objCell)

    oleMethod (objCell, "Select")

    clear args

    //put (args, objCell) // does not work either

    put (args, "Destination", objCell)

    print oleMethod (ws, "Paste",args) } }}

    }

    --------------------------------------------------------

    -Ashok Anumula





    #Sustainability
    #DOORS
    #Support
    #SupportMigration
    #EngineeringRequirementsManagement