Hi,
I am fairly new at programming for Excel so please forgive my naivety. I am trying to port an Excel workbook with macros from a Windows machine to a Mac. After opening the workbook on the Mac I found that none of the macros seemed to work. Upon further investigation I found that whatever version of Excel that was used to create the workbook used an "=EMBED("Forms.CommandButton.1","")" construct for all of the buttons on the spreadsheet. I read several articles on line about using command buttons and tried some of the examples but the versions that I have (2002 on Windows and 2004 on Mac) do not create an "=EMBED()" construct. Instead they just create a macro call like "Sub Button1_Click()". When I went through the workbook and deleted all of the "=EMBED()" constructs and just linked each button to the appropriate macro it seemed to work fine on both the Windows and Mac machines.
Now I have gotten deeper into the workbook and have found that "=EMBED("Forms.CheckBox.1","")" and "=EMBED("Forms.OptionButton.1","")" are also used. When I tried to create my own checkbox or option button I found that these also did not use the "=EMBED()" construct any more and just linked to a macro such as "Sub MyCheck_Click()" or "Sub MyOption_Click()". With the "=EMBED()" form you could get the value of the check box by looking at, for example, MyCheck.Value but that no longer seems to be the way to get at the information on if the box is checked or not. I tried the following two tests but without success. They always return "False".
Sub MyCheck_Click()
If MyCheck = True Then
MsgBox "Checked"
ElseIf MyCheck = False Then
MsgBox "Unchecked"
Else
MsgBox "Neither state returned"
End If
End Sub
Sub MyOption_Click()
If MyOption = True Then
MsgBox "Checked"
ElseIf MyOption = False Then
MsgBox "Unchecked "
Else
MsgBox "Neither state returned "
End If
End Sub
So, my question is twofold: 1) Have things changed with respect to the form of the "CommandButton" between versions prior to 2002 and 2002?, and 2) How do I now get to the value of the checkbox?
Thanks for your help!
Bookmarks