Posted by Dave Hawley on May 17, 2001 9:43 PM
Hi Tuc
Private Sub Workbook_Open()
MsgBox Application.Version
End Sub
BTW Excel 97 also supports Workbook_open
Dave
OzGrid Business Applications
Posted by Tuc on May 18, 2001 7:07 AM
The documentation says that it supports Workbook_open, but I have had some issue with it working every time. Auto_Open works every time in Excel 97. I would use workbook_Open if the solution was Excel 2000.
Posted by Tuc on May 18, 2001 7:07 AM
The documentation says that it supports Workbook_open, but I have had some issue with it working every time. Auto_Open works every time in Excel 97. I would use workbook_Open if the solution was Excel 2000.
Posted by Dave Hawley on May 18, 2001 7:41 AM
Tuc, if you haved saved the file as 97 version the Workbook_Open will work. What issues have you had? Perhaps you had Events to False unknowingly?
Dave
OzGrid Business Applications
Posted by Tuc on May 18, 2001 8:16 AM
Dave,
Great minds think alike! I purposedly avoided using the EnabledEvents property of the application object so that would not be an issue. As for saving it as an Excel 97 document, it was developed initially only on the Excel 97 platform (Excel 97 SR-2(h)).
It is my understanding that there is not supposed to be any differences in the file formats of Excel 97 and Excel 2000. Is this not true?
I reviewed my development notes (I did not have them with me last night). This mainly for the weirdness of the solution (not my design). In this instance, when the workbook was being opened inside of an ActiveX control the Workbook_Open event wasn't firing, but the Auto_Open event was. To insure that I could develop correctly and test in the environment, I simply added the Auto_Open event and called it from the Workbook_Open event, covering both bases.
Posted by Dave Hawley on May 18, 2001 8:38 AM
Tuc, they say there is no file format issues between 2000 and 97, but I have already run into an issue with the two vesrions. I developed a program for a client recently (on Excel 2000) that made use of the Workbook_Activate Event among others. As soon as it was Opened or Activated on Excel 97 it gave the dreaded "illegal operation" message. The solution (by a lot of trial and error) ended up being opening the file (with the Shift key held down) and then simply retyping one line of code and saving it as 97 only. I have no idea why this worked.
ActiveX controls do have some issues. possibly the main one being that they Retain Focus once clicked (by Default) you need to set the "TakeFocusOnClick" Property to False. I tend to use the CommandButton from the Forms toolbar if I only need to run a macro.
Dave
OzGrid Business Applications
Posted by Tuc on May 18, 2001 9:26 AM
Sounds good. Follow up question...
Tuc, they say there is no file format issues between 2000 and 97, but I have already run into an issue with the two vesrions. I developed a program for a client recently (on Excel 2000) that made use of the Workbook_Activate Event among others. As soon as it was Opened or Activated on Excel 97 it gave the dreaded "illegal operation" message. The solution (by a lot of trial and error) ended up being opening the file (with the Shift key held down) and then simply retyping one line of code and saving it as 97 only. I have no idea why this worked. ActiveX controls do have some issues. possibly the main one being that they Retain Focus once clicked (by Default) you need to set the "TakeFocusOnClick" Property to False. I tend to use the CommandButton from the Forms toolbar if I only need to run a macro.
Dave,
Yes, I understand. I'll look into the TakeFocusOnClick property.
What other issues come to mind when working with ActiveX controls drawn directly on the worksheet? I am using checkboxes and command buttons to initiate actions (one to change state, and the other to execute a procedure) I'm finding inconsistencies when I copy the worksheet. For example in XL97 if I named the check box to a "meaningful" name, for example chk_Product, when the worksheet (that the control is part of) is copied, the control is renamed back to the "original" control name, in this case CheckBox1. This means that the code that I wrote behind the action of chk_Product_Click is now dead code. In XL2K, the names are preserved, although not all the time. I haven't been able to pin down the exact behaviour yet. I thought it might happen when I copy a worksheet from one workbook to another, but I still have more tests to do on that.
Tuc