473,385 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Setting font size of text box in VBA

I want to be able to set the font size and font type for text in a text box
on a report using VBA. I wan't to be able to control it from a setting in a
table. The problem is that I don't know the syntax for setting either font
type or font size for a text box on a report. Does anyone know? Help.
Please!

dixie
Nov 12 '05 #1
5 27794
ctlTextBox.Height = 1440 'size in twips: 1440 = 1 inch
ctlTextBox.Width = 2880 'size in twips: 1440 = 1 inch

'so you can see the area covered by the textbox
ctlTextBox.BackColor = RGB(255, 255, 0)

ctlTextBox.FontSize = 20
ctlTextBox.FontName = "Comic Sans MS"

changing the font size, name, bolding, means you may also need to change
the size of the textbox correspondingly. 1 inch is 1440 twips

John Bickmore
www.BicycleCam.com
www.Feed-Zone.com

"dixie" <di****@dogmail.com> wrote in message
news:C0*****************@nnrp1.ozemail.com.au...
I want to be able to set the font size and font type for text in a text box on a report using VBA. I wan't to be able to control it from a setting in a table. The problem is that I don't know the syntax for setting either font type or font size for a text box on a report. Does anyone know? Help.
Please!

dixie

Nov 12 '05 #2
Dixie,
In the Report's Detail Format event:

If [SomeField] = "Something" Then
[SomeField].FontName = "Ariel"
[SomeControl].FontSize = "12"
Else
[SomeField].FontName = "Times New Roman"
[SomeControl].FontSize = "10"
End If

--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.
"dixie" <di****@dogmail.com> wrote in message
news:C0*****************@nnrp1.ozemail.com.au...
I want to be able to set the font size and font type for text in a text box on a report using VBA. I wan't to be able to control it from a setting in a table. The problem is that I don't know the syntax for setting either font type or font size for a text box on a report. Does anyone know? Help.
Please!

dixie

Nov 12 '05 #3
Thankyou for that Fred. There isn't an equivalent type of setting for page
margins is there? I have looked at the width and height settings, but
nowhere can I find anything that would allow me to programatically set the
position of the left margin based on a value that could be placed in a
table. This would be quite useful.

dixie

"Fredg" <fg******@example.invalid> wrote in message
news:R2**********************@bgtnsc05-news.ops.worldnet.att.net...
Dixie,
In the Report's Detail Format event:

If [SomeField] = "Something" Then
[SomeField].FontName = "Ariel"
[SomeControl].FontSize = "12"
Else
[SomeField].FontName = "Times New Roman"
[SomeControl].FontSize = "10"
End If

--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.
"dixie" <di****@dogmail.com> wrote in message
news:C0*****************@nnrp1.ozemail.com.au...
I want to be able to set the font size and font type for text in a text box
on a report using VBA. I wan't to be able to control it from a setting

in a
table. The problem is that I don't know the syntax for setting either

font
type or font size for a text box on a report. Does anyone know? Help.
Please!

dixie


Nov 12 '05 #4
Dixie,

It's hard to help as you haven't given enough information as to what you
expect to happen.
The below ** Air code ** should move each control 3/4" to the right if
[SomeControl] = "Something",
otherwise it will move all the controls 3/4" to the left (1440 Twips per
inch).
Place it in whatever format event the controls are in.
Place the leftmost control at least 3/4" from the left margin.
Place the right side of the rightmost control at least 3/4" from the right
margin.

Adapt this as needed.

Dim c as Control
For each c in controls
If [SomeField] = "Something" Then
c.left = c.left + (1440 * 0.75)
Else
c.left = c.left - (1440 * 0.75)
End If

To actually change the left margin, look up the PrtMips method in VBA help.
However, to use it, the report must be open in Design View, not during
runtime.

--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.
"dixie" <di****@dogmail.com> wrote in message
news:Vx************@nnrp1.ozemail.com.au...
Thankyou for that Fred. There isn't an equivalent type of setting for page margins is there? I have looked at the width and height settings, but
nowhere can I find anything that would allow me to programatically set the
position of the left margin based on a value that could be placed in a
table. This would be quite useful.

dixie

"Fredg" <fg******@example.invalid> wrote in message
news:R2**********************@bgtnsc05-news.ops.worldnet.att.net...
Dixie,
In the Report's Detail Format event:

If [SomeField] = "Something" Then
[SomeField].FontName = "Ariel"
[SomeControl].FontSize = "12"
Else
[SomeField].FontName = "Times New Roman"
[SomeControl].FontSize = "10"
End If

--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.
"dixie" <di****@dogmail.com> wrote in message
news:C0*****************@nnrp1.ozemail.com.au...
I want to be able to set the font size and font type for text in a text
box
on a report using VBA. I wan't to be able to control it from a
setting in
a
table. The problem is that I don't know the syntax for setting either

font
type or font size for a text box on a report. Does anyone know?

Help. Please!

dixie



Nov 12 '05 #5
That looks promising fred, I'll have a play with it. What I am actually
trying to achieve is to be able to move the address on a letter sideways so
it will fit into various sorts of windowed envelopes. Since the movement I
see is usually to the right, this will probably work OK.

Thanks
dixie

"Fredg" <fg******@example.invalid> wrote in message
news:e2**********************@bgtnsc05-news.ops.worldnet.att.net...
Dixie,

It's hard to help as you haven't given enough information as to what you
expect to happen.
The below ** Air code ** should move each control 3/4" to the right if
[SomeControl] = "Something",
otherwise it will move all the controls 3/4" to the left (1440 Twips per
inch).
Place it in whatever format event the controls are in.
Place the leftmost control at least 3/4" from the left margin.
Place the right side of the rightmost control at least 3/4" from the right
margin.

Adapt this as needed.

Dim c as Control
For each c in controls
If [SomeField] = "Something" Then
c.left = c.left + (1440 * 0.75)
Else
c.left = c.left - (1440 * 0.75)
End If

To actually change the left margin, look up the PrtMips method in VBA help. However, to use it, the report must be open in Design View, not during
runtime.

--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.
"dixie" <di****@dogmail.com> wrote in message
news:Vx************@nnrp1.ozemail.com.au...
Thankyou for that Fred. There isn't an equivalent type of setting for

page
margins is there? I have looked at the width and height settings, but
nowhere can I find anything that would allow me to programatically set the
position of the left margin based on a value that could be placed in a
table. This would be quite useful.

dixie

"Fredg" <fg******@example.invalid> wrote in message
news:R2**********************@bgtnsc05-news.ops.worldnet.att.net...
Dixie,
In the Report's Detail Format event:

If [SomeField] = "Something" Then
[SomeField].FontName = "Ariel"
[SomeControl].FontSize = "12"
Else
[SomeField].FontName = "Times New Roman"
[SomeControl].FontSize = "10"
End If

--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.
"dixie" <di****@dogmail.com> wrote in message
news:C0*****************@nnrp1.ozemail.com.au...
> I want to be able to set the font size and font type for text in a

text box
> on a report using VBA. I wan't to be able to control it from a setting
in
a
> table. The problem is that I don't know the syntax for setting either font
> type or font size for a text box on a report. Does anyone know?

Help. > Please!
>
> dixie
>
>



Nov 12 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Jacob Weber | last post by:
Hello. Is it possible to specify the exact space between two lines, measured from the baseline of the top line to the ascenders of the second line? I tried adding the space with padding-bottom,...
21
by: Michael Bierman | last post by:
Please forgive the simplicy of this question. I have the following code which attempts to determine the color of some text and set other text to match that color. It works fine in Firefox, but does...
18
by: fleemo17 | last post by:
My organization is developing a set of "standards" for websites built inhouse. The first question that comes to mind is what would be a good standard default size for <p> text? 12 point? Which...
1
by: Mervin Williams | last post by:
I am having a problem setting the CSSClass property of a my Label control. I set CSSClass property, but its not taking the font style settings. Here is my style: ..TabText { font-weight:...
14
by: Roger Withnell | last post by:
How to I find out what size text the browser is set to? Thanks in anticipation.
2
by: Charleees | last post by:
Hi all, I have a DataGrid with Template Columns..... There are LAbels,Linkbuttons in the Single Row.. I have to set the Constant Column width for those Template Columns in Grid... Wat...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
12
by: karen987 | last post by:
I have an ASP web page which has a style sheet attached. It is a news page which is added from a separate admin section. The news adding section does have a rich text editor to change text or format...
6
by: Steve | last post by:
I have a div with two - three paragrahs in it. Each paragraph has its own inline style tag with its own font size setting. When I set the last paragraph's font size the font sizes for ALL of...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.