Jan 13 2020 06:50 AM
I'm hoping an expert on this site can help me. I recently build a macro embedded form and I am trying to figure out how I can corner drag the form in order to make the window and the text larger as I drag the corners. This macro embedded form is also deployed on a macbook pro using office for Mac. When it is opened on the mac, the form is significantly smaller. I also noticed that there is no developer tab in the MAc version of excel. any insight is very appreciated.
Jan 13 2020 06:59 AM - edited Jan 13 2020 07:00 AM
@jzombek Userforms indeed are smaller when shown on a mac, but making the form sizable is not the easiest way to solve this as normally we use Windows API calls to make a form sizable and that does not work on a MAC. You could use code similar to this to make the userform OS-aware and act accordingly:
#If Mac Then
Dim objCtl As MSForms.Control
With Me
.Font.Size = 10
.Width = .Width * 4 / 3
.Height = .Height * 4 / 3
End With
For Each objCtl In Me.Controls
With objCtl
.Left = Int(.Left * 4 / 3)
.Top = Int(.Top * 4 / 3)
.Width = Int(.Width * 4 / 3)
.Height = Int(.Height * 4 / 3)
Select Case TypeName(objCtl)
Case "Image", "SpinButton"
Case "TextBox", "Frame"
.Font.Size = 10
Case Else
.Font.Size = 10
End Select
End With
Next
#End If
Jan 13 2020 07:09 AM
To include the Developer ribbon on a Mac:
Top menu: Excel / Preferences
Icon: Ribbon & Toolbar
Find "Developer" on the left-hand side in "All Tabs" and send it to the right.
Jan 13 2020 07:11 AM
@Jan Karel Pieterse Thank you very much. This is of great help Do I place this code at the beginning to the Module form code?
(your code right here)
Sub auto_open()
'
' Macro1 Macro
'
'
Sheets("FORM").Cells.ClearContents
Sheets("FORM").Cells(1, 3).Value = "Exercises To Be Performed"
UserForm1.Show
Unload UserForm1
End Sub
Jan 13 2020 08:20 AM
@Jan Karel Pieterse Okay, I will place it there. Thank you again for your help. I really appreciate it