Excel frustration

Join Date
Mar 2009
Location
Charleston SC
Posts
8
Ok here is the issue. I have a machine I am developing a MMI for. Using Wonderware V.10. I am interfaced with a VME processor that talks to AutoMax. AutoMax link is on OPC and VME to MMI is DDE. Get discrete from AutoMax via OPC to VME processor. Then VME does the whole bit swap thing (AutoMax is Motorola and VME and MMI is Intel). Anyway to make a long story short I am using packed 16 bit words to pass discrete values back and forth on the DDE network. I can unpack the word just fine in wonderware using (Reflective Memory Location) . (bit number) format. Now here is where it gets interesting. I have built an excel spread sheet with all my packed words and I want to display the bit values for trouble shooting purposes. I wrote a VB script in excel to unpack the word. I can get bits 0-14 but bit 15 gets a #value error in the cell.

VB code:

Function ExamineBit (ByVal tag, ByVal MyBit) as Boolean
Dim BitMask as Integer
BitMask = 2 ^ MyBit
ExamineBit = tag and BitMask
End Function

I am thinking excel is expecting the MSB of the 16 bit word to be a sign bit. Anybody done this before?


Ok figured it out:

BitMask needs to be a Long not Integer
 
Last edited:

Similar Topics

Hi, I'm trying to export data from a DataGrid to Excel using VBA, but I'm getting an error "Object doesn't support this property or method". The...
Replies
0
Views
77
I don't know if this is the right place for the subject at least I'll try. The company has one of the oldest computers that is a master Windows...
Replies
5
Views
741
Hi, I'm just looking for a simple way to make a button in excel (via VBA I presume) to toggle a bit in RSLogix 5000. I just got FactoyTalkLinx...
Replies
9
Views
545
Hello, I want to send the data from Rslogix500 to Excel. I created a connection between RSlinx and Excel. The values in Excel automatically...
Replies
5
Views
1,181
Hi guys, Im back again, this time I cannot minimized excel even though i put 6 on the exec mode.. this is my cicode.. Exec("C:\Program...
Replies
1
Views
1,093
Back
Top Bottom