Quantcast
Channel: OSIsoft Users Community
Viewing all articles
Browse latest Browse all 1120

Change number of decimal digits - Excel VBA

$
0
0

Hello,

 

I looked around and didn't find a solution here.

I am trying to run this code just to test a few things so I can implement in my other sheet.

Sub piTest()

    Dim srv As Server
    Dim pt As PIPoint
    Dim pv As PIValue
    
    Set srv = Servers.DefaultServer
    Set pt = srv.PIPoints("myPItag")
    pt.Server.Open ("myserver")
    
    Set pv = pt.DATA.ArcValue("25/08/2014 17:20:00", rtInterpolated)
    If pv.IsGood Then
        MsgBox CStr(pv.Value)
    Else
        MsgBox "bad value"
    End If
    

End Sub

The problem is that I getting a value with 2 decimal digits, like: 7229,34.

If I go to the sheet and use this formul:

=PICurrVal("myPItag";0;)

I get a value with 8 decimal digits, like: 7229,33984375

 

What I need is to specify thru VBA to get more decimal digits. If it's possible, I need to get all decimal digits.

 

Probably this is stupied, but this is the first time I am using PI thru VBA. I always use only formulas.

 

Thank you.


Viewing all articles
Browse latest Browse all 1120

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>