Unable To Return To Normal Texct From Italic

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,564
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I was successfull in italicizing text in my textbox, but I am struggling with turning the italic format off to return the text to normal.

Code:
                With uf9_poststaff
                    .pin.Enabled = True
                    .dcard_id.Enabled = True
                    .dcard_no.Enabled = True
                    .dcard_id.Font.Italic = False
                    .dcard_id.ForeColor = RGB(0, 0, 0)
                    .dcard_no.Font.Italic = False
                    .dcard_no.ForeColor = RGB(0, 0, 0)
                    .pin.Font.Italic = False
                    .pin.Font.ForeColor = RGB(0, 0, 0)
                    mbevents = True
                
                    .vm_emplschedule.Enabled = True
                    .v_employeepp.Enabled = True
                End With

Is anyone able to reveal what I'm doing wrong?
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
This instruction does not change to normal?
Code:
[COLOR=#0000ff].dcard_id.Font.Italic = False[/COLOR]
Does it send you an error?
 
Upvote 0
Hi Dante,

No, it doesn't for some reason, which is why I posted. No errors thown either. It seems pretty simple which is why I am at odds as to why it isn't working. All other properties I change for these textboxes get applied, just not the italic.
 
Upvote 0
Hello,

Just create a test file, a simple userform with a TextBox ...

And test again your exact code ...

It will allow to determine if your Excel version has a problem ... or not ...

Hope this will help
 
Upvote 0
And if you play a little with the letter styles.
eg.


Code:
        'italic on
        Me.dcard_id.Font.Name = "Monotype Corsiva"
        '
        'italic off
        Me.dcard_id.Font.Name = "Tahoma"
 
Upvote 0
Just create a test file, a simple userform with a TextBox ...
The problem was not recreated in the test file. I was able to toggle between italic and non italic in the textbox without issue.

And if you play a little with the letter styles.

In my code, after the set the .font.italic = false, I added the line .font.name = "Monotype Corsiva".
The textbox remained in italics, but the font changed.
 
Upvote 0
The problem is the font style

This does not work

Turn on:
Code:
        Me.dcard_id.Font.Name = "Monotype Corsiva"
        Me.dcard_id.Font.Italic = True

Turn off:
Code:
        Me.dcard_id.Font.Name = "Monotype Corsiva"
        Me.dcard_id.Font.Italic = False


This works:
Turn on:
Code:
        Me.dcard_id.Font.Name = "Tahoma"
        Me.dcard_id.Font.Italic = True

Turn off:
Code:
        Me.dcard_id.Font.Name = "Tahoma"
        Me.dcard_id.Font.Italic = False


Then use another font style
 
Upvote 0
This worked for me:

Instead of Me.TextBox19.Font.Italic = False, the Me.TextBox19.FontItalic = False code worked fine. Just remove the dot between Font and Italic.

Hope to help
 
Upvote 0

Forum statistics

Threads
1,223,155
Messages
6,170,405
Members
452,325
Latest member
BlahQz

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top