none
How to access/change KeepAlive property from Connections? RRS feed

  • Question

  • On the OpenXml reference there is a KeepAlive property.

    If you create a connection, pivot cache and pivot table through programming, roughly as:

    Dim workbookConnection As workbookConnection
    Set workbookConnection = ThisWorkbook.Connections.Add(connectionID, "", connectionString, commandText, XlCmdType.xlCmdCube)
    
    Dim pivotCache As pivotCache
    Set pivotCache = ThisWorkbook.PivotCaches.Create(xlExternal, workbookConnection, XlPivotTableVersionList.xlPivotTableVersion16)
        
    Dim pt As PivotTable
    Set pt = pivotCache.CreatePivotTable(TableDestination:=Sheet1.Range("A1"), TableName:="TableName", DefaultVersion:=XlPivotTableVersionList.xlPivotTableVersion16)
    And save the file, if you inspect the content of the file (uncompressing), you'll see that the connection has no definition of KeepAlive.

    But if you create a connection, through the data wizard, Data Tab, Get data from other sources, Analysis Services, and save the file, when you inspect the content of the file (uncompressing), you'll find the the connection has a KeepAlive = "1".

    I can't seem to find a way to identify through programming if the connection KeepAlive has being set or the value that currently has on the same process.

    How can I read/access/change this property of connections? (Because excel uses that value to keep open the connection as the OpenXml reference says KeepAlive property).


    .NET Developer and BI noob


    • Edited by RogerCC Thursday, March 9, 2017 6:55 PM KeepAlive reference added
    Thursday, March 9, 2017 6:48 PM

All replies

  • Hi RogerCC,

    I will try to find a code example for this requirement and provide to you as soon as possible.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, March 10, 2017 9:54 AM
    Moderator
  • Hi.

    Any updates on the code example, I'm really afraid that there is no code example.

    I'll keep waiting on any updates regarding the subject. (Maybe a no code available)

    Roger Camargo


    .NET Developer and BI noob

    Monday, March 13, 2017 7:16 PM
  • Hi RogerCC,

    I try to find the code , but unfortunately I did not able to find any example code for setting this property.

    I will try to search further and if I find the code then I will try to provide you.

    thanks for your understanding.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, March 20, 2017 9:52 AM
    Moderator