drausim127@spiratec

Excel VBA - PIDataLink - PICompDat() - Resize to show all values

Discussion created by drausim127@spiratec on Dec 5, 2013
Latest reply on Dec 9, 2013 by ee.ashley

Hi,

 

I'm using PIDataLink 2013 in combination with Excel VBA. I have developed a macro which one will be executed when a button in the Excel-Sheet is pressed. Following a short extract of this code:

 

Function getAllValuesResult(ByVal tStartZeit As String, ByVal tEndZeit As String, ByVal tServer As String, ByVal tTagName As String) As String()
    Dim tempResult As Variant
    On Error GoTo MErr

    tempResult = Application.Run("PICompDat", tTagName, tStartZeit, tEndZeit, 9, tServer, "inside")
    
    .....
MErr:
    MsgBox Err.Description, vbCritical, "Ausnahmefehler"
End Function

 

What I do is nothing more then using the Compressed Data Function of PIDataLink via VBA. The problem is that in tempResult most of the time the result is "Resize to show all values" and not the archived values.

 

For my understanding this message only appears when the result array is to small but in this case I haven't initialized an array with a defined array size. The second strange think is when I select the checkbox "Disable Resize to show all values messge" then this message never appears and everything looks good.

 

Hopefully somebody have an idea why this happens.

 

best Markus

Outcomes