I have a button (Form Control not ActiveX Control) that when pressed, calls a sub procedure inside inside a worksheet module for the worksheet that the button is on.
For whatever reason after opening the workbook the first time I click on the button, it produces a 400 error:
Every time I click on the button after this first time, it runs the sub procedure as expected.
As a test I put a "Stop" command as the first line of the sub and it seems as though the 400 error happens before the sub procedure is even called.
I also tested putting the exact sub procedure in to a new module and assigning the button to that sub procedure. Doing this results in no error - So I can run the sub procedure by clicking on the button if it is outside of the worksheet module, but not inside..![Confused :confused: :confused:](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
I am so baffled as to why this would happen. I have disabled all add-ins to see if that is what the issue is, but that didn't change anything.
Any ideas for what the problem might be or how I can fix it? I can move all of my code outside of the worksheet modules, but that would be quite a pain, because this same thing is an issue for many programs that I have written, and I would hate to have to change all of them.
For whatever reason after opening the workbook the first time I click on the button, it produces a 400 error:
![400+error.jpg](/board/proxy.php?image=http%3A%2F%2F1.bp.blogspot.com%2F-y9lZi5_vOtA%2FU8z26DfPGRI%2FAAAAAAAAAEQ%2FcA1iz4_bYe8%2Fs1600%2F400%2Berror.jpg&hash=686460f7b0e30d8d9b109b4ec729a6e9)
Every time I click on the button after this first time, it runs the sub procedure as expected.
As a test I put a "Stop" command as the first line of the sub and it seems as though the 400 error happens before the sub procedure is even called.
I also tested putting the exact sub procedure in to a new module and assigning the button to that sub procedure. Doing this results in no error - So I can run the sub procedure by clicking on the button if it is outside of the worksheet module, but not inside..
I am so baffled as to why this would happen. I have disabled all add-ins to see if that is what the issue is, but that didn't change anything.
Any ideas for what the problem might be or how I can fix it? I can move all of my code outside of the worksheet modules, but that would be quite a pain, because this same thing is an issue for many programs that I have written, and I would hate to have to change all of them.