UnsolvedCoding
Technical User
Greetings one and all,
This one has been bothering me for awhile and Microsoft hasn't been any help.
I have code to open a workbook, however due to the known bug in Excel sometimes the code simply stops when the workbook is opened. Microsofts patch (below) deals with the shift key and isn't helping and I need to find a way to open the workbook, run the code to fill out the worksheets and then close the workbook.
I can step through the process and most of the time run it directly, and if the workbook is open I can skip the line to open the workbook and it will run fine. But getting the code to run all the time with the workbook open event is problematic.
Does anyone know how to resolve this?
It has taken me a while to make sense of what I hear at work involving computers. There is much talk of bugs and questions about Raid.
Therefore I have come to the logical conclusion that the only way to have a properly functioning computer is to regularly spray it with Raid bug killer.
This one has been bothering me for awhile and Microsoft hasn't been any help.
I have code to open a workbook, however due to the known bug in Excel sometimes the code simply stops when the workbook is opened. Microsofts patch (below) deals with the shift key and isn't helping and I need to find a way to open the workbook, run the code to fill out the worksheets and then close the workbook.
I can step through the process and most of the time run it directly, and if the workbook is open I can skip the line to open the workbook and it will run fine. But getting the code to run all the time with the workbook open event is problematic.
Does anyone know how to resolve this?
Code:
'Declare API
Declare Function GetKeyState Lib "User32" _
(ByVal vKey As Integer) As Integer
Const SHIFT_KEY = 16
Function ShiftPressed() As Boolean
'Returns True if shift key is pressed
ShiftPressed = GetKeyState(SHIFT_KEY) < 0
End Function
Sub Demo()
Do While ShiftPressed()
DoEvents
Loop
Workbooks.Open = "C:\My Documents\ShiftKeyDemo.xls"
End Sub
It has taken me a while to make sense of what I hear at work involving computers. There is much talk of bugs and questions about Raid.
Therefore I have come to the logical conclusion that the only way to have a properly functioning computer is to regularly spray it with Raid bug killer.