On the Mac, it’s 96 dpi, where each dot represents a pixel. One of the most noticeable is related to the difference in screen resolution between the two platforms. The F5 key opens Go To, select Special Shortcuts for Excel formulas.There are many annoyances when designing a VBA project to run on both Windows and Mac computers. If so, the SpinButton's Value property is set to the value entered in the TextBox.Go To Special in Excel is an important function for financial modeling spreadsheets. (If the TextBox contains non-numeric text, the Val function returns 0.) The next statement determines whether the value is within the proper range for the SpinButton. This procedure starts by using VBA's Val function to convert the text in the TextBox to a value.Hit Alt and use the shortcuts. Modern Mac computers using an Apple keyboard have icons printed on some of the Open Excel. This is especially important with Excel, which uses a number of function keys for shortcuts. The result is that without applying any correction, UserForms that come out just right in Windows are only 75% as large on the Mac, making them difficult to read.If you want to master Excel keyboard shortcuts on a Mac, you need to take a moment to understand how the Mac keyboard is arranged, and how it can be configured through system preferences. Confusing the issue is that VBA in Windows uses points as the measurement unit for designing UserForms, while VBA on the Mac uses pixels.The spin button can be found in the insert section of the ribbon. Next, click on the spin button (4th button from the left). In the controls group, click insert. To select the spin button, you must be in the developer tab. The text might seem a bit small to me now that my eyes are getting older, but it’s still perfectly legible.Spin Button Step 2: Select the Spin Button. I built this using Catalina's new accessibility features to control Excel and re-create the alt-key shortcuts on Mac.For example, here is a UserForm designed in Windows, opened in Windows.
![]() First, it is shown opened in Windows.Below it’s shown opened on the Mac. Aside from this, it works pretty nicely.Here is a UserForm designed in Windows, but which uses the resizing routine so it displays legibly on either computer. I do make sure when I design the form that controls are more than large enough in case the text takes up extra space. Spin Button Excel Code Is IgnoredIn Windows, this code is ignored, and the UserForm is displayed without rescaling.The global resizing factor is placed in an appropriate place in the declarations section of a regular code module: Public Const gUserFormResizeFactor As Double = 1.333333And this routine in a regular code module does the resizing: Sub ResizeUserForm(frm As Object, Optional dResizeFactor As Double = 0#)If dResizeFactor = 0 Then dResizeFactor = gUserFormResizeFactorFor iCol = LBound(vColWidths) To UBound(vColWidths)VColWidths(iCol) = Val(vColWidths(iCol)) * dResizeFactorI’ve posted a simple workbook that illustrates this technique. When using a Mac, the constant Mac is True, so the code between #If and #End If is compiled and run, so the UserForm is resized. The Code.This calls the routine from the UserForm’s code module: Private Sub UserForm_Initialize()The #If Mac Then and #End If structure indicates a section of code which is conditionally compiled. You have to build them into your file in Windows and them move the file to the Mac. Sometimes a large block of text may not wrap the same, so if it really matters, you should hard code your line breaks by typing Ctrl+Return while entering the text.Note: While Microsoft has substantially improved the VB editor on the Mac, you still can’t work with UserForms on the Mac. Before deploying them to your users, you should make sure that the UserForms that look fine in Windows rescale properly on a Mac. Pretty large.If you enter 1 in the box, you can see how the form would look without resizing.In all of your real projects, you should apply this technique to all of your UserForms. Resized nicely.Let’s see how it looks at 200%. Note that it’s already resized to 1.333333. Yeah, way too small.Here is the same form opened on a Mac. Here is it opened in Windows.Enter a number in the New Form Magnification box (for example 2) and click Apply, and the form is resized accordingly.Enter 1.333333, the ratio between pixels and points, and this is how it will be resized for the Mac, though it’s too large for Windows.Enter 0.75, the inverse of the above, and you get a sense for how small it would be on the Mac without rescaling. So I designed all of my UserForms to use other approaches besides MultiPages (such as regular buttons that ran code to show and hide other controls). The Mac version was Excel 2011, and many of the UserForm controls looked awful, especially the MultiPage. But this eliminates the need for separate UserForms for Mac and Windows.I started using this code on my UserForms before Excel 2016 was released (Excel 2016 was the first version in which Mac and Windows user interfaces and VBA components actually looked alike). Google voice dictation for macIf not, do the page switch right after you show it, and the flash might not be too noticeable. This may be enough to get the expected background color. Having a non-default background may help to avoid the problem.Here’s a real suggestion: When you load the UserForm, before you Show it, select a different page of the MultiPage, then select the page you want to open with. Point is, I haven’t noticed the issue you mention.I’ve also designed my UserForms to use a light blue background rather than the default muddy gray.
0 Comments
Leave a Reply. |
AuthorTia ArchivesCategories |