hurleypa2002
New Member
- Joined
- Aug 12, 2004
- Messages
- 31
Hello,
Have the following code that keeps giving me a runtime error code of (-2147417848(80010108)) or a method 'range' of object'_worksheet'failed message. I can surpress the errors with an exit sub routine but would really like to fix the issue......
On the worksheet I have a cell the communicates to a PLC through DDE:
Cell is a special ("AO3") =RSLINX|Auto_55!'LINX_BITS.Bit[0],L1,C1'
other cell is ("AM3") =IF(AO3=1,1,0)
Macro code for Sheet:
-----code---
then for sheet 1
Private Sub Worksheet_Calculate()
On Error GoTo Waittime:
'Goes to Waittime on hich-up from RS Linx
--------the next line is giving me the error ---------------
If Sheets("Sheet1").Range("AM3") = 0 Then
' PLC save bit AM3, Internal bit AM5
-----sometime it will error on this line instead----------
Sheets("Sheet1").Range("AM5") = 0
'Reset Bit to PLC save if PLC save bit low
If Sheets("Sheet1").Range("BJ2") = 1 Then
Sheets("Sheet1").Range("BJ2") = 0
RSI = Application.DDEInitiate(app:="RSLinx", topic:="Auto_55")
Data = "Linx_bits_From_Desktop.bit[1]"
Set rangetopoke = Worksheets("sheet1").Range("BJ2")
DDEPoke RSI, Data, rangetopoke
DDETerminate RSI
End If
End If
'
--- more code----
any help on how to rewrite the lines of code to avoid the error would get a "many thanks"
Pat
Have the following code that keeps giving me a runtime error code of (-2147417848(80010108)) or a method 'range' of object'_worksheet'failed message. I can surpress the errors with an exit sub routine but would really like to fix the issue......
On the worksheet I have a cell the communicates to a PLC through DDE:
Cell is a special ("AO3") =RSLINX|Auto_55!'LINX_BITS.Bit[0],L1,C1'
other cell is ("AM3") =IF(AO3=1,1,0)
Macro code for Sheet:
-----code---
then for sheet 1
Private Sub Worksheet_Calculate()
On Error GoTo Waittime:
'Goes to Waittime on hich-up from RS Linx
--------the next line is giving me the error ---------------
If Sheets("Sheet1").Range("AM3") = 0 Then
' PLC save bit AM3, Internal bit AM5
-----sometime it will error on this line instead----------
Sheets("Sheet1").Range("AM5") = 0
'Reset Bit to PLC save if PLC save bit low
If Sheets("Sheet1").Range("BJ2") = 1 Then
Sheets("Sheet1").Range("BJ2") = 0
RSI = Application.DDEInitiate(app:="RSLinx", topic:="Auto_55")
Data = "Linx_bits_From_Desktop.bit[1]"
Set rangetopoke = Worksheets("sheet1").Range("BJ2")
DDEPoke RSI, Data, rangetopoke
DDETerminate RSI
End If
End If
'
--- more code----
any help on how to rewrite the lines of code to avoid the error would get a "many thanks"
Pat
Last edited: