dk_ said:
If I understand you correctly, you mainly build a userform on one
platform (a Mac for example), then on the other platform (a Windows
machine), you turn the Macro recroder 'on', and then record the tweaks
that are necessary to make the userform display right on the Windows
machine? Is that what you do? If so, that makes sense to me.
I've done this, I've also used hidden sheets in an add-in to specify
position, size, font size, etc. for each control in a table, then read
the table on the userform intialize event. Doing this is *much* more
flexible, especially if you start getting into localization or other
run-time modifications.
If the above is mostly right, then what is the code that the Macro can
use to know that the Macro should be run. In other words how does the
Macro trigger itself to run when the file is opened in the appropriate
platform (the Windows machine, or vise versa)?
One way is to use conditional compilation. For example, with a userform,
MyUserForm containing some controls, including two button controls,
btnOK and btnClose:
Dim frmMyForm As MyUserForm
Set frmMyForm = New MyUserForm
Load frmMyForm
#If Mac Then
ModifyMyUserFormForMac frmMyForm
#End If
frmMyForm.Show
....
Public Sub ModifyMyUserFormForMac(byRef frm As MyUserForm)
Const cnBtnHeight As Long = 20
Const cnBtnWidth As Long = 60
With frm
With .btnClose
.Left = 100&
.Top = 200&
.Width = cBtnWidth
.Height = cBtnHeight
End With
With .btnOK
.Left = 175&
.Top = 200&
.Width = cBtnWidth
.Height = cBtnHeight
End With
'etc.
End With
End Sub