Marlett font missing from VBA object properties - excel

I want to place a green tick mark on a userform and thought that creating a label with the caption "a" in Marlett font would do the trick. However, Marlett isn't showing up in the object properties despite definitely being installed. I can easily place the tick mark in a cell, but not in a label. Is there a way to enable it for userforms?
There is an answer to the same problem in the c# section - How do I set button font to Marlett, but I'm not sure if it can be applied to VBA as well.

It's as simple as putting:
Label1.Font.Name = "Marlett"
Label1.Caption = "a"
(important: this code only seems to work if you set the font before setting the caption; setting the caption first seems to prevent setting the font from having an effect - thanks to #N.N.Thoughts for the info)
in the Userform_Initialize event of your userform. Replace Label1 with the name of the actual control
edit: with the addition of code to set the font size and colour:
Label1.Font.Size = "32"
Label1.ForeColor = RGB(0, 255, 0)

Related

How to set UIDatePicker background color to white in xamarin.ios for ios 14?

I am hiding a label by a UIDatePicker in a xamarin.ios app. I changed the style of the datepicker label but can't change the background to white. Here is my code:
datePickerDateFrom.Frame = lblFromDate.Frame;
datePickerDateFrom.Subviews[0].Subviews[0].SetValueForKey(UIColor.White, new NSString("backgroundColor"));
datePickerDateFrom.Subviews[0].Subviews[0].TintColor = UIColor.Black;
datePickerDateFrom.Subviews[0].Subviews[0].Layer.BorderWidth = 1;
datePickerDateFrom.Subviews[0].Subviews[0].Layer.CornerRadius = 6;
datePickerDateFrom.Subviews[0].Subviews[0].Layer.BorderColor = UIColor.FromRGB(0, 184, 212).CGColor;
datePickerDateFrom.SizeToFit();
Add(datePickerDateFrom);
And the result is:
Any other color works but if I set the color to white it remains this ash color that's why sometimes there is a color difference inside the blue border when the short date format is selected. I don't know is it possible to align the value inside the frame and specify any fixed date format(as sometimes it displays 3 letter of month name when gets larger space). For now changing the background color to white would be a great help. Thanks in advance.

How to increase the size of a checkbox?

I'm trying to increase the size of a checkbox in my Userform.
In the properties tab, I can change the height and the width of the object but it doesn't change the size of the square. I add a picture to explain my issue.
Thank you.
#Portland Runner's comment is a good suggestion. For example, in the click event of the label (using WingDings 2) ...
Option Explicit
Private Sub Label1_Click()
If Label1.Caption = "Q" Then
Label1.Caption = "R"
Else
Label1.Caption = "Q"
End If
End Sub
There are 2 problems with the VBA checkbox:
The size of the square
The size of the caption text
My solutions:
Create a frame in which you put the checkbox object. A frame has the property Zoom. Set that property at whatever value you want. Then change the font size of the button to match the rest of the fonts in the form. The frame doesn't have to have a title, and you can select an invisible border for it. In that way, the user doesn't see it.
For whatever reason, the checkbox's text looks smaller than the rest of the objects, even though it is the same font size. My solution for this was to remove the checkbox's text and add a standard label object to the right.

VBA code to reset command button sizes and place them at specific named ranges

I'm using Excel 2010 - I have a number of named Command Buttons and Toggle Buttons that tend to move around or get set to a height and width of 0 so I want to add vba code to reset the command buttons and toggle buttons sizes and locate them at a specific named range.
For example names cb1, cb2, cb3, cb4 to be set at range names cbrn1, cbrn2, cbrn3, cbrn4 respectively with a width of 20 and height of 20 and tb1, tb2, tb2, tb4 to be set at range names tbrn1, tbrn2, tbrn3, tbrn4 with a width of 10 and height of 10. How would I do this by using an if then loop?
Your help would be more than appreciated :-)
I am not sure exactally on your question. But I am just trying to be helpful. You are trying to set the sizes in code? you can make a default size function size(20,20) for the typeof(control) If I had a small code clip I could be more helpful. you said 2010 so I am assuming .net even though VBA usually refers to pre-.net ie vb 4,5,6
For each obj as Control in Me.Controls
Select case typeof obj
if typeof (obj) is ComboBox then
obj.size = (20,20)
elseif typeof(obj) is ToggleButton then
obj.size = (0,0)
end if
next
tried to use spaces there to make it more readable. This code is not exact. but if I am correct on the type of question you are asking this "pseudo-code" should help it did not format correct hope it does this time if not. should still get the idea

How do I make an Excel ActiveX label to be transparent ... at runtime?

I want to put a transparent label on top of a sheet in Excel, so that I can take advantage of the MouseMove event of the label to "draw cells" (aka change their fill color and so on) by mouse click / drag / etc. - since I can't do that on the cells per se.
Now everything works just fine, except that I can't make the label transparent at runtime (aka in VBA) ... while by doing exactly the same thing in Design Mode works as expected. Specifically, I have the code (more or less):
Dim MapLabel As OLEObject
On Error Resume Next
Sheet2.OLEObjects("MapLabel").Delete
Set MapLabel = Sheet2.OLEObjects.Add("Forms.Label.1")
MapLabel.name = "MapLabel"
MapLabel.Placement = xlMoveAndSize
MapLabel.Object.Caption = ""
' Problem line below
MapLabel.Object.BackStyle = fmBackStyleTransparent
' Problem line above
MapLabel.Left = Sheet2.cells(2, 6).Left
MapLabel.Top = Sheet2.cells(2, 6).Top
MapLabel.Width = Sheet2.cells(2,6).Width * 10
MapLabel.Height = Sheet2.cells(2,6).Height * 10
So, in words, I first delete the label named 'MapLabel', then recreate it (the above code goes into a "init" Sub). All the code lines except the one marked produce the desired result. The marked one does set the BackStyle property of the label to fmBackStyleTransparent ... but it doesn't actually make the label transparent. This is frustrating, because it's the same approach that works flawlessly at design time!
Do you have a solution to this? I read about solving similar problems by declaring the label as MsForms.Label or as Control, but the sheet object doesn't have those properties, plus, there are far more label properties which can be set using the OLEObject than with the help of MsForms.Label or Control.
All you need to do after this line:
MapLabel.Object.BackStyle = fmBackStyleTransparent
put this line:
ActiveSheet.Shapes(MapLabel.Name).Fill.Transparency = 1
I hope I helped.
P.S. If you need explanation i will edit my answer.
I had the same problem as you but in Word. The solution for me was to do the following:
In design mode:
Right click on the object
Navigate to Switch to automatic form/Image > Wrapping > In front of the text
Add an empty picture to your label

Create Colour in InDesign CS5 with CMYK values from user input

I'm trying to create a script which, in the process of opening a template file, asks the user for a set of CMYK values.
The idea is to then either change the value of an existing colour (called "Primary Colour") therefore changing the colour of every item to which it is applied...or add this new colour and delete 'Primary Colour' replacing it with new colour.
The problem is I can't get past creating a new colour with user input values. I can create a new colour with;
set New_Swatch to make color with properties {name:"New Primary Colour", model:process, color value:{82,72,49,46}}
however as soon as I try to replace the color value with a variable I get the error;
"Adobe InDesign CS5 got an error: Invalid parameter."
Here is a snippet of code in context;
set primaryColour to text returned of (display dialog "Enter CMYK calues of Primary Colour (separated by commas e.g. 0,0,0,0)" default answer "") as string
tell application "Adobe InDesign CS5"
activate
tell active document
set New_Swatch to make color with properties {name:"new", model:process, color value:primaryColour}
end tell
end tell
Any help gratefully received.
I currently use this:
set primaryColor to text returned of (display dialog "Enter CMYK values of Primary Colour (separated by commas e.g. 0,0,0,0)" default answer "") as string
set text item delimiters to ","
set colorvalue to {}
repeat with color from 1 to count of text items of primaryColor
copy (text item colour of primaryColor as number) to end of colorvalue
end repeat
set colorname to "TEST"
tell application "Adobe InDesign CS5"
activate
tell active document
set newcolor to make color with properties {name:colorname, space:CMYK, model:process, color value:colorvalue}
end tell
end tell
Why? Because it works. It is not pretty and it was not my first, or even 10th method to get the job done...Why this works? No idea...
It just does. You would think that:
set text item delimiters to ","
set {C,M,Y,K} to text items of primaryColor
...
set newcolor to make color with properties {name:colorname, space:CMYK, model:process, color value:{C,M,Y,K}}
Would do the trick, but it doesn't... I'm sure your attempts so far have proven just how much of a pain this particular function is.
You may also want to use the AppleScript “choose color” command, which presents a color picker, rather than presenting your user with a dialog into which they have to enter numeric color values.
This example inserts RGB colors as text into a BBEdit window, but you would use the same principle to insert CMYK colors as text into InDesign.
tell application "BBEdit"
activate
set theColorValues to choose color
set theR to round (the first item of theColorValues) / 257
set theG to round (the second item of theColorValues) / 257
set theB to round (the third item of theColorValues) / 257
set theRGBColor to "rgb(" & theR & ", " & theG & ", " & theB & ")"
set selection to theRGBColor
end tell
set primaryColor to text returned of (display dialog "Enter CMYK values of Primary Color (separated by commas e.g. 0,0,0,0)" default answer "") as string
set text item delimiters to ","
set colorvalue to {}
repeat with color from 1 to count of text items of primaryColor
copy (text item color of primaryColor as number) to end of colorvalue
end repeat
set colorname to primaryColor
tell application "Adobe InDesign CC 2017"
activate
tell active document
set newcolor to make color with properties {name:colorname, space:CMYK, model:process, color value:colorvalue}
end tell
end tell

Resources