線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1623
推到 Plurk!
推到 Facebook!

請問如何使 excel 的字串中的某個字變成斜體?

缺席
jtain
一般會員


發表:16
回覆:18
積分:6
註冊:2005-01-03

發送簡訊給我
#1 引用回覆 回覆 發表時間:2009-08-06 11:42:27 IP:211.21.xxx.xxx 訂閱
從網路上找到可以設定字體的程式。

但我要如何把某個字串中的一個單字變成斜體或黑體?
底下是我用 excel 巨集抓下來的,有人可以幫我轉成 BCB 嗎?


[code vb]
Sub Macro2()

Range("A1").Select
ActiveCell.FormulaR1C1 = "He gained his nickname for killing"
With ActiveCell.Characters(Start:=1, Length:=3).Font
.Name = "Times New Roman"
.FontStyle = "標準"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With ActiveCell.Characters(Start:=4, Length:=10).Font
.Name = "Times New Roman"
.FontStyle = "斜體"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With ActiveCell.Characters(Start:=14, Length:=10).Font
.Name = "Times New Roman"
.FontStyle = "標準"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With ActiveCell.Characters(Start:=24, Length:=2).Font
.Name = "Times New Roman"
.FontStyle = "粗體"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With ActiveCell.Characters(Start:=26, Length:=2).Font
.Name = "Times New Roman"
.FontStyle = "標準"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With ActiveCell.Characters(Start:=28, Length:=7).Font
.Name = "Times New Roman"
.FontStyle = "標準"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleSingle
.ColorIndex = xlAutomatic
End With
Range("A2").Select
End Sub
[/code]
------
無所不在
系統時間:2017-10-24 19:31:28
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!