|
|
|
本章では、セルの書式設定に関するコードサンプルを例示しています。 |
|
|
|
段落(改行マークで区切られた部分)
Dim p As Paragraph
Set p = ActiveDocument.Paragraphs(1)
MsgBox Replace(p.Range.Text,Chr(13)、””) '改行マークがついているのでカットオする
Set p = Nothing
表
ActiveDocument.Tables(1).Columns(1).Cells(1) |
|
|
|
段落(改行マークで区切られた部分)
Dim p As Paragraph
Set p = ActiveDocument.Paragraphs(1)
p.Range.Text = "あいうえお" & Chr(13) '改行マークを付ける
Set p = Nothing |
|
|
|
Sub 文書内の文字を検索()
''検索条件のクリア
Selection.Find.ClearFormatting
With Selection.Find
.Text = "奈良"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
.MatchFuzzy = True
End With
Selection.Find.Execute
If Selection.Find.Found Then
MsgBox Selection
End If
End Sub |
|
|
|
Sub 文書内の文字の置換()
'
Dim kensakuMJ, tikanMJ As String
kensakuMJ = "検索文字"
tikanMJ = "置換文字"
''検索条件のクリア
Selection.Find.ClearFormatting
'置換条件のクリア
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = kensakuMJ
.Replacement.Text = tikanMJ
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchByte = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
.MatchFuzzy = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
|
|
|
|
|
Sub Kensaku_Web()
Dim word As String
Dim URL As String
word = Selection
URL = "http://eow.alc.co.jp/" & word '英辞郎
URL = "http://www.google.co.jp/search?q=" & word 'Google
検索
ActiveDocument.FollowHyperlink Address:=URL, NewWindow:=False, AddHistory:=True
End Sub |
|
|
|
|
Selection.HomeKey Unit:=wdStory '文書の先頭位置へカーソルを移動
Selection.EndKey Unit:=wdStory '文書の最終位置へカーソルを移動 |
|
|