<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Word | You Look Too Cool</title>
	<atom:link href="https://stabucky.com/wp/archives/category/digital/microsoft-digital/word/feed" rel="self" type="application/rss+xml" />
	<link>https://stabucky.com/wp</link>
	<description>ゆるくつくる stabuckyのブログ</description>
	<lastBuildDate>Fri, 25 Apr 2025 12:45:29 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://stabucky.com/wp/wp-content/uploads/2024/05/cropped-stabucky-32x32.png</url>
	<title>Word | You Look Too Cool</title>
	<link>https://stabucky.com/wp</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Wordの二枚目からページ番号を付ける方法</title>
		<link>https://stabucky.com/wp/archives/19843</link>
					<comments>https://stabucky.com/wp/archives/19843#respond</comments>
		
		<dc:creator><![CDATA[stabucky]]></dc:creator>
		<pubDate>Fri, 25 Apr 2025 10:08:14 +0000</pubDate>
				<category><![CDATA[Word]]></category>
		<category><![CDATA[ページ]]></category>
		<guid isPermaLink="false">https://stabucky.com/wp/?p=19843</guid>

					<description><![CDATA[Wordの表紙にはページ番号をつけず、二枚目からページ番号を付ける方法です。 二枚目は1ページにします。 目次 デスクトップ版オンライン版 デスクトップ版 二枚目の先頭にカーソルを移動。 メニューの レイアウト &#82 [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Wordの表紙にはページ番号をつけず、二枚目からページ番号を付ける方法です。<br />
二枚目は1ページにします。</p>

  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-2" checked><label class="toc-title" for="toc-checkbox-2">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">デスクトップ版</a></li><li><a href="#toc2" tabindex="0">オンライン版</a></li></ol>
    </div>
  </div>

<h2><span id="toc1">デスクトップ版</span></h2>
<p>二枚目の先頭にカーソルを移動。<br />
メニューの レイアウト &#8211; ページ設定 &#8211; 区切り &#8211; 現在の位置から開始 を選択。<br />
メニューの 挿入 &#8211; ヘッダーとフッター &#8211; フッター &#8211; フッターの編集 を選択。<br />
メニューの デザイン &#8211; ナビゲーション の 前と同じヘッダー/フッター をオフにする。※オンだとグレーになっている。クリックするとオフになる。<br />
メニューの デザイン &#8211; ヘッダーとフッター &#8211; ページ番号 &#8211; ページの下部 &#8211; 番号のみ2 を選択。<br />
メニューの デザイン &#8211; ヘッダーとフッター &#8211; ページ番号 &#8211; ページ番号の書式設定 を選択。<br />
開始番号 にチェックし、1を選択して OK をクリック。</p>
<h2><span id="toc2">オンライン版</span></h2>
<p>二枚目からページ番号を付けることはできますが、2ページからになってしまいます。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://stabucky.com/wp/archives/19843/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Wordで色を変えて置換するマクロ</title>
		<link>https://stabucky.com/wp/archives/14428</link>
					<comments>https://stabucky.com/wp/archives/14428#respond</comments>
		
		<dc:creator><![CDATA[stabucky]]></dc:creator>
		<pubDate>Mon, 06 Sep 2021 07:01:41 +0000</pubDate>
				<category><![CDATA[Word]]></category>
		<category><![CDATA[VBA]]></category>
		<category><![CDATA[置換]]></category>
		<category><![CDATA[色]]></category>
		<guid isPermaLink="false">https://stabucky.com/wp/?p=14428</guid>

					<description><![CDATA[Wordは文字列の置換をするときに書式を設定することができるので文字の色を変えることもできます。 これをマクロに応用してみました。 Sub テスト() &#160; Call 色を変えて置換(&#34;エディタ&#038;quo [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Wordは文字列の置換をするときに書式を設定することができるので文字の色を変えることもできます。<br />
これをマクロに応用してみました。<span id="more-14428"></span></p>
<div class="codecolorer-container text dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:400px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">Sub テスト()<br />
&nbsp; Call 色を変えて置換(&quot;エディタ&quot;, wdColorRed, &quot;エディタ&quot;, wdColorBlue)<br />
End Sub<br />
<br />
Function 色を変えて置換(moto_text, moto_color, saki_text, saki_color)<br />
&nbsp; Set myrange = ActiveDocument.Range(Start:=0, End:=0)<br />
&nbsp; With myrange.Find<br />
&nbsp; &nbsp; .ClearFormatting<br />
&nbsp; &nbsp; .Font.Color = moto_color<br />
&nbsp; &nbsp; .Replacement.ClearFormatting<br />
&nbsp; &nbsp; .Replacement.Font.Color = saki_color<br />
&nbsp; &nbsp; .Text = moto_text<br />
&nbsp; &nbsp; .Replacement.Text = saki_text<br />
&nbsp; &nbsp; .Execute Replace:=wdReplaceAll<br />
&nbsp; End With<br />
End Function</div></div>
<p>「テスト」が実行用のコードです。</p>
<p>「色を変えて置換」が置換する部分です。<br />
moto_text, moto_color, saki_text, saki_colorにそれぞれ検索文字列、置換元の色、置換文字列、置換先の色をセットします。</p>
<p>色はwdColorRedなどのVBAの定数で表します。<br />
内容は<a rel="noopener" href="https://docs.microsoft.com/ja-jp/office/vba/api/word.wdcolor" target="_blank">WdColor 列挙 (Word) | Microsoft Docs</a>にあります。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://stabucky.com/wp/archives/14428/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>複数のWord文書に対して文字列リストを元に連続して置換するマクロ</title>
		<link>https://stabucky.com/wp/archives/13067</link>
					<comments>https://stabucky.com/wp/archives/13067#comments</comments>
		
		<dc:creator><![CDATA[stabucky]]></dc:creator>
		<pubDate>Thu, 21 May 2020 22:07:40 +0000</pubDate>
				<category><![CDATA[Word]]></category>
		<category><![CDATA[VBA]]></category>
		<category><![CDATA[置換]]></category>
		<guid isPermaLink="false">https://stabucky.com/wp/?p=13067</guid>

					<description><![CDATA[以前、Wordに関する次の二つのマクロを紹介しました。 Wordで文字列リストを元に連続して置換するマクロ 複数のWord文書に対して文字列置換 今般、「これらを組み合わせたい」という要望をいただきましたので、試してみま [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>以前、Wordに関する次の二つのマクロを紹介しました。<br />
<a href="https://stabucky.com/wp/archives/2309">Wordで文字列リストを元に連続して置換するマクロ</a><br />
<a href="https://stabucky.com/wp/archives/7897">複数のWord文書に対して文字列置換</a><br />
今般、「これらを組み合わせたい」という要望をいただきましたので、試してみました。<span id="more-13067"></span></p>

  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-6" checked><label class="toc-title" for="toc-checkbox-6">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">準備</a></li><li><a href="#toc2" tabindex="0">リスト</a></li><li><a href="#toc3" tabindex="0">コード</a></li><li><a href="#toc4" tabindex="0">下階層対応版</a></li></ol>
    </div>
  </div>

<h2><span id="toc1">準備</span></h2>
<p>適当なフォルダに文字列置換したいWordファイルを保存します。これを「対象フォルダ」と呼びます。<br />
確認せずに一気に置換して上書き保存しますので、これらのファイルは<strong>必ずバックアップ</strong>を取っておいてください。<br />
利用に関しては自己責任でお願いします。</p>
<h2><span id="toc2">リスト</span></h2>
<p>マクロ実行用のWordファイルを準備します。「対象フォルダ」とは別のフォルダに保存します。<br />
本文に次のようなリストを書いておきます。<br />
置換前と置換後の文字列を並べ、セミコロン(;)で区切ります。</p>
<div class="codecolorer-container text dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:400px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">エディター;エディタ<br />
プリンター;プリンタ<br />
サーバー;サーバ</div></div>
<h2><span id="toc3">コード</span></h2>
<p>次のコードを使います。使い方が分からない場合は「<a href="https://stabucky.com/wp/archives/13029" target="_blank">マクロを書く方法</a>」を参照してください。<br />
マクロを実行するとフォルダを選ぶダイアログが出ます。「対象フォルダ」を選択してください。<br />
選択するとフォルダ内のファイルが順に開き、リストに従って次々に置換が実行され、上書き保存されます。</p>
<div class="codecolorer-container text dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:400px;height:400px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">Sub 複数文書連続処理_リストを元に置換()<br />
&nbsp; Dim mae(100)<br />
&nbsp; Dim ato(100)<br />
&nbsp; <br />
&nbsp; '置換用配列<br />
&nbsp; Set paras = ActiveDocument.Paragraphs<br />
&nbsp; x = 0<br />
&nbsp; For i = 1 To paras.Count<br />
&nbsp; &nbsp; thisline = paras(i).Range.Text<br />
&nbsp; &nbsp; parts = Split(thisline, &quot;;&quot;)<br />
&nbsp; &nbsp; If UBound(parts) &gt; 0 Then<br />
&nbsp; &nbsp; &nbsp; mae(x) = parts(0)<br />
&nbsp; &nbsp; &nbsp; ato(x) = Replace(parts(1), Chr(13), &quot;&quot;)<br />
&nbsp; &nbsp; &nbsp; x = x + 1<br />
&nbsp; &nbsp; End If<br />
&nbsp; Next i<br />
&nbsp; <br />
&nbsp; 'フォルダの選択<br />
&nbsp; With Application.FileDialog(msoFileDialogFolderPicker)<br />
&nbsp; &nbsp; .Title = &quot;フォルダを選択&quot;<br />
&nbsp; &nbsp; .AllowMultiSelect = False<br />
&nbsp; &nbsp; If .Show = -1 Then<br />
&nbsp; &nbsp; &nbsp; mypath = .SelectedItems(1) &amp; &quot;\&quot;<br />
&nbsp; &nbsp; Else<br />
&nbsp; &nbsp; &nbsp; MsgBox &quot;終了します。&quot;<br />
&nbsp; &nbsp; &nbsp; Exit Sub<br />
&nbsp; &nbsp; End If<br />
&nbsp; End With<br />
&nbsp; <br />
&nbsp; 'Word文書に対する処理<br />
&nbsp; myfile = Dir(mypath &amp; &quot;*.doc*&quot;)<br />
&nbsp; Do While myfile &lt;&gt; &quot;&quot;<br />
&nbsp; &nbsp; Documents.Open FileName:=mypath &amp; myfile<br />
&nbsp; &nbsp; For i = 0 To x - 1<br />
&nbsp; &nbsp; &nbsp; Call 文書全体を置換(mae(i), ato(i))<br />
&nbsp; &nbsp; Next i<br />
&nbsp; &nbsp; ActiveWindow.Close SaveChanges:=wdSaveChanges<br />
&nbsp; &nbsp; myfile = Dir<br />
&nbsp; Loop<br />
End Sub<br />
Function 文書全体を置換(mae, ato)<br />
&nbsp; Set myrange = ActiveDocument.Range(Start:=0, End:=0)<br />
&nbsp; With myrange.Find<br />
&nbsp; &nbsp; .ClearFormatting<br />
&nbsp; &nbsp; .Text = mae<br />
&nbsp; &nbsp; With .Replacement<br />
&nbsp; &nbsp; &nbsp; .ClearFormatting<br />
&nbsp; &nbsp; &nbsp; .Text = ato<br />
&nbsp; &nbsp; End With<br />
&nbsp; &nbsp; .Execute Replace:=wdReplaceAll<br />
&nbsp; End With<br />
End Function</div></div>
<h2><span id="toc4">下階層対応版</span></h2>
<p>「<a href="https://stabucky.com/wp/archives/7253">下の階層を含めたファイル一覧を作成するマクロ</a>」を参考にして、指定したフォルダの配下のフォルダに対応したバージョンを作りました。<br />
宣言以降、全てのコードを下のとおり、まとめました。全てをコピー＆ペーストするだけで使えます。</p>
<div class="codecolorer-container text dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:400px;height:400px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">Dim all_files(9999, 1) As String<br />
Dim last_index<br />
<br />
Sub 複数文書連続処理_リストを元に置換()<br />
&nbsp; Dim mae(100)<br />
&nbsp; Dim ato(100)<br />
&nbsp; <br />
&nbsp; '置換用配列<br />
&nbsp; Set paras = ActiveDocument.Paragraphs<br />
&nbsp; x = 0<br />
&nbsp; For i = 1 To paras.Count<br />
&nbsp; &nbsp; thisline = paras(i).Range.Text<br />
&nbsp; &nbsp; parts = Split(thisline, &quot;;&quot;)<br />
&nbsp; &nbsp; If UBound(parts) &gt; 0 Then<br />
&nbsp; &nbsp; &nbsp; mae(x) = parts(0)<br />
&nbsp; &nbsp; &nbsp; ato(x) = Replace(parts(1), Chr(13), &quot;&quot;)<br />
&nbsp; &nbsp; &nbsp; x = x + 1<br />
&nbsp; &nbsp; End If<br />
&nbsp; Next i<br />
&nbsp; <br />
&nbsp; 'フォルダの選択<br />
&nbsp; With Application.FileDialog(msoFileDialogFolderPicker)<br />
&nbsp; &nbsp; .Title = &quot;フォルダを選択&quot;<br />
&nbsp; &nbsp; .AllowMultiSelect = False<br />
&nbsp; &nbsp; If .Show = -1 Then<br />
&nbsp; &nbsp; &nbsp; mypath = .SelectedItems(1) &amp; &quot;\&quot;<br />
&nbsp; &nbsp; Else<br />
&nbsp; &nbsp; &nbsp; MsgBox &quot;終了します。&quot;<br />
&nbsp; &nbsp; &nbsp; Exit Sub<br />
&nbsp; &nbsp; End If<br />
&nbsp; End With<br />
&nbsp; <br />
&nbsp; '全てのファイル名を取得（下階層を含む）<br />
&nbsp; Call get_files(mypath)<br />
&nbsp; <br />
&nbsp; 'Word文書に対する処理<br />
&nbsp; j = 0<br />
&nbsp; Do<br />
&nbsp; &nbsp; Documents.Open FileName:=all_files(j, 1) &amp; all_files(j, 0)<br />
&nbsp; &nbsp; For i = 0 To x - 1<br />
&nbsp; &nbsp; &nbsp; Call 文書全体を置換(mae(i), ato(i))<br />
&nbsp; &nbsp; Next i<br />
&nbsp; &nbsp; ActiveWindow.Close SaveChanges:=wdSaveChanges<br />
&nbsp; &nbsp; j = j + 1<br />
&nbsp; Loop Until all_files(j, 0) = &quot;&quot;<br />
End Sub<br />
Function 文書全体を置換(mae, ato)<br />
&nbsp; Set myrange = ActiveDocument.Range(Start:=0, End:=0)<br />
&nbsp; With myrange.Find<br />
&nbsp; &nbsp; .ClearFormatting<br />
&nbsp; &nbsp; .Text = mae<br />
&nbsp; &nbsp; With .Replacement<br />
&nbsp; &nbsp; &nbsp; .ClearFormatting<br />
&nbsp; &nbsp; &nbsp; .Text = ato<br />
&nbsp; &nbsp; End With<br />
&nbsp; &nbsp; .Execute Replace:=wdReplaceAll<br />
&nbsp; End With<br />
End Function<br />
Function get_files(my_path)<br />
&nbsp; 'Word用<br />
&nbsp; '指定したフォルダにある全てのファイル名(パス付)を取得する。<br />
&nbsp; Dim this_file(999) As String<br />
&nbsp; Dim this_path As String<br />
&nbsp; Dim i As Long<br />
&nbsp; Dim j As Long<br />
&nbsp; this_file(0) = Dir(my_path, vbDirectory)<br />
&nbsp; i = 0<br />
&nbsp; Do<br />
&nbsp; &nbsp; i = i + 1<br />
&nbsp; &nbsp; this_file(i) = Dir<br />
&nbsp; Loop Until this_file(i) = &quot;&quot;<br />
&nbsp; For j = 0 To i - 1<br />
&nbsp; &nbsp; If this_file(j) &lt;&gt; &quot;.&quot; And this_file(j) &lt;&gt; &quot;..&quot; Then<br />
&nbsp; &nbsp; &nbsp; If GetAttr(my_path &amp; this_file(j)) = vbDirectory Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; Call get_files(my_path &amp; this_file(j) &amp; &quot;\&quot;)<br />
&nbsp; &nbsp; &nbsp; ElseIf InStr(this_file(j), &quot;.doc&quot;) &gt; 0 Then<br />
&nbsp; &nbsp; &nbsp; &nbsp; all_files(last_index, 0) = this_file(j)<br />
&nbsp; &nbsp; &nbsp; &nbsp; all_files(last_index, 1) = my_path<br />
&nbsp; &nbsp; &nbsp; &nbsp; last_index = last_index + 1<br />
&nbsp; &nbsp; &nbsp; End If<br />
&nbsp; &nbsp; End If<br />
&nbsp; Next j<br />
End Function</div></div>
<p>2020年7月18日追記<br />
「下階層のファイルにも対応させたい」という要望をいただきましたので、試してみました。</p>
<p>2022年5月24日追記<br />
Word文書以外が保存されている場合でも対応できるように修正しました。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://stabucky.com/wp/archives/13067/feed</wfw:commentRss>
			<slash:comments>30</slash:comments>
		
		
			</item>
		<item>
		<title>Wordで半角カタカナを全角カタカナに変換するマクロ</title>
		<link>https://stabucky.com/wp/archives/12072</link>
					<comments>https://stabucky.com/wp/archives/12072#comments</comments>
		
		<dc:creator><![CDATA[stabucky]]></dc:creator>
		<pubDate>Fri, 01 Mar 2019 22:17:23 +0000</pubDate>
				<category><![CDATA[Word]]></category>
		<category><![CDATA[VBA]]></category>
		<category><![CDATA[変換]]></category>
		<guid isPermaLink="false">https://stabucky.com/wp/?p=12072</guid>

					<description><![CDATA[昔は半角カタカナは文字化けするなど不具合の原因になると言われていたので私は半角カタカナを使いません。しかし使う人はいます。Wordでも使う人がいます。格好が悪いです。 Wordには半角を全角に変換する機能がありますが英数 [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>昔は半角カタカナは文字化けするなど不具合の原因になると言われていたので私は半角カタカナを使いません。しかし使う人はいます。Wordでも使う人がいます。格好が悪いです。<br />
Wordには半角を全角に変換する機能がありますが英数字も変換してしまいます。<br />
半角カタカナだけを全角に変換するマクロを作ってみました。<span id="more-12072"></span></p>
<div class="codecolorer-container text dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:400px;height:400px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">Sub 半角カタカナを全角カタカナに変換()<br />
&nbsp; '20190227 作成<br />
&nbsp; '20190312 修正<br />
&nbsp; '全角カタカナ（ァ...ヶ）<br />
&nbsp; For c = -31936 To -31850<br />
&nbsp; &nbsp; zen = Chr(c)<br />
&nbsp; &nbsp; han = StrConv(zen, vbNarrow)<br />
&nbsp; &nbsp; Call 置換(han, zen)<br />
&nbsp; Next c<br />
&nbsp; 'ｰ→ー(長音)<br />
&nbsp; han = &quot;ｰ&quot;<br />
&nbsp; zen = &quot;ー&quot;<br />
&nbsp; Call 置換(han, zen)<br />
End Sub<br />
<br />
Function 置換(oldValue, newValue)<br />
&nbsp; '20190227 作成<br />
&nbsp; Set myRange = ActiveDocument.Range(Start:=0, End:=0)<br />
&nbsp; With myRange.Find<br />
&nbsp; &nbsp; .ClearFormatting<br />
&nbsp; &nbsp; .Text = oldValue<br />
&nbsp; &nbsp; With .Replacement<br />
&nbsp; &nbsp; &nbsp; .ClearFormatting<br />
&nbsp; &nbsp; &nbsp; .Text = newValue<br />
&nbsp; &nbsp; End With<br />
&nbsp; &nbsp; .Execute Replace:=wdReplaceAll<br />
&nbsp; End With<br />
End Function</div></div>
<p><img fetchpriority="high" decoding="async" src="https://stabucky.com/wp/wp-content/uploads/2010/06/vbalogo.jpg" alt="" width="400" height="152" class="alignnone size-full wp-image-11120" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://stabucky.com/wp/archives/12072/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Wordでワイルドカード検索の結果を使って置換するサンプル</title>
		<link>https://stabucky.com/wp/archives/9372</link>
					<comments>https://stabucky.com/wp/archives/9372#respond</comments>
		
		<dc:creator><![CDATA[stabucky]]></dc:creator>
		<pubDate>Sat, 25 Mar 2017 00:45:18 +0000</pubDate>
				<category><![CDATA[Word]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[ワイルドカード]]></category>
		<category><![CDATA[置換]]></category>
		<guid isPermaLink="false">http://stabucky.com/wp/?p=9372</guid>

					<description><![CDATA[Wordのワイルドカードを使うと検索した結果を使って少し複雑な置換をすることができます。 例えば「福沢 諭吉」を「諭吉 福沢」のように姓名を逆にしたりすることもできます。 「検索する文字列」で特定の箇所を半角括弧で挟むと [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Wordのワイルドカードを使うと検索した結果を使って少し複雑な置換をすることができます。<br />
例えば「福沢 諭吉」を「諭吉 福沢」のように姓名を逆にしたりすることもできます。</p>
<p>「検索する文字列」で特定の箇所を半角括弧で挟むと、その箇所を「置換後の文字列」として指定することができます。<br />
「特殊文字」として「検索する文字列式(X)\n」を使います。</p>
<p>次は「03(1234)5678」と表記した電話番号を「03-1234-5678」に置換するサンプルです。<br />
なお「ワイルドカードを使用する」にチェックしておきます(他のチェックは外す)。<br />
Word2013で確認しました。<span id="more-9372"></span><br />
※環境によっては 半角の円記号（￥） が 半角のバックスラッシュ（＼） で表示されるかもしれませんが、Wordの表示に合わせて読み替えてください。一般的には 半角の円記号 です。</p>
<p><img decoding="async" src="https://stabucky.com/wp/wp-content/uploads/2013/09/Logo_Word.png" alt="" width="145" height="60" class="img-responsive" /></p>
<p>置換前<br />
03(1234)5678<br />
06(6012)3456<br />
043(123)4567</p>
<p>置換後<br />
03-1234-5678<br />
06-6012-3456<br />
043-123-4567</p>
<p>検索する文字列<br />
([0-9]@)\(([0-9]@)\)([0-9]@)</p>
<p>置換後の文字列<br />
\1-\2-\3</p>
<p>「[0-9]」とすると半角数字となります。<br />
「@」を付けると直前の文字の繰返しとなります。「[0-9]@」とすると「03」「043」「1234」などが該当します。<br />
「\(」「\)」とすると半角括弧となります。<br />
半角括弧で挟んだ順に「\1」「\2」「\3」でその箇所を「置換後の文字列」として使用できます。</p>
<p>次は同様に「(03)1234-5678」と表記した電話番号を「03-1234-5678」に置換するサンプルです。</p>
<p>置換前<br />
(03)1234-5678<br />
(06)6012-3456<br />
(043)123-4567</p>
<p>置換後<br />
03-1234-5678<br />
06-6012-3456<br />
043-123-4567</p>
<p>検索する文字列<br />
\(([0-9]@)\)([0-9]@)-([0-9]@)</p>
<p>置換後の文字列<br />
\1-\2-\3</p>
]]></content:encoded>
					
					<wfw:commentRss>https://stabucky.com/wp/archives/9372/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Wordの検索で使える特殊文字一覧</title>
		<link>https://stabucky.com/wp/archives/9242</link>
					<comments>https://stabucky.com/wp/archives/9242#respond</comments>
		
		<dc:creator><![CDATA[stabucky]]></dc:creator>
		<pubDate>Mon, 20 Feb 2017 12:41:10 +0000</pubDate>
				<category><![CDATA[Word]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[一覧]]></category>
		<guid isPermaLink="false">http://stabucky.com/wp/?p=9242</guid>

					<description><![CDATA[Wordの「検索と置換」ダイアログで「あいまい検索」のチェックを外すと「特殊文字」を使えるようになります。 しかし意味が分からないので調べてみました。それでも分からない記号もあります。ご容赦ください。Word2013で確 [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Wordの「検索と置換」ダイアログで「あいまい検索」のチェックを外すと「特殊文字」を使えるようになります。<br />
しかし意味が分からないので調べてみました。それでも分からない記号もあります。ご容赦ください。Word2013で確認しました。<br />
なお、「検索する文字列」にカーソルがあり、「ワイルドカードを使用する」にチェックしない場合です。<span id="more-9242"></span></p>
<dl>
<dt>段落記号^p</dt>
<dd>Enterを押すと入力される記号です。「<a href="https://stabucky.com/wp/archives/1857">Wordの段落記号と改行記号</a>」を参照してください。</dd>
<dt>タブ文字^t</dt>
<dd>Tabを押すと入力される記号です。</dd>
<dt>任意の1文字^?</dt>
<dd>ひらがな、漢字、英数字など任意の一文字に相当します。段落記号も対象になります。</dd>
<dt>任意の数字^#</dt>
<dd>半角、全角の数字が該当します。</dd>
<dt>任意の英字^$</dt>
<dd>半角、全角の英字が該当します。英字に置換すると大文字は大文字に、小文字は小文字に置換されます。</dd>
<dt>キャレット^^</dt>
<dd>「^」という記号です。</dd>
<dt>§セクションの文字^%</dt>
<dd>「§」という記号です。</dd>
<dt>¶段落の文字^v</dt>
<dd>「¶」という記号です。</dd>
<dt>段区切り^n</dt>
<dd>「段区切り」は段組みをしているときに次の段に配置するためのものです。「&#8230;..段区切り&#8230;..」のように表示されます。メニューの ページレイアウト &#8211; ページ設定 &#8211; 区切り &#8211; 段区切り を選択してセットします。</dd>
<dt>省略記号^i</dt>
<dd>Wordのみで使える記号のようです。</dd>
<dt>3点リーダー^j</dt>
<dd>「…」という記号です。</dd>
<dt>全角ダッシュ^+</dt>
<dd>「—」という記号です。</dd>
<dt>1/4スペース^q</dt>
<dd>Wordのみで使える記号のようです。</dd>
<dt>半角ダッシュ^=</dt>
<dd>「半角ダッシュ」は「–」という記号です。</dd>
<dt>任意指定の改行^x</dt>
<dd>Wordのみで使える記号のようです。</dd>
<dt>改行なし^z</dt>
<dd>分かりません。</dd>
<dt>文末脚注記号^e</dt>
<dd>「文末脚注記号」は文末脚注を挿入した箇所です。</dd>
<dt>フィールド^d</dt>
<dd>分かりません。</dd>
<dt>脚注記号^f</dt>
<dd>脚注を挿入した箇所です。</dd>
<dt>グラフィック^g</dt>
<dd>分かりません。</dd>
<dt>任意指定の行区切り^l</dt>
<dd>分かりません。</dd>
<dt>任意指定のページ区切り^m</dt>
<dd>分かりません。</dd>
<dt>改行をしないハイフン^~</dt>
<dd>見た目は通常の半角ハイフンですが改行しません。例えば「abc-def」が右端にあると「abc-」で切れて「def」は次の行に送られます。しかし改行をしないハイフンを使うと途中で切れず「abc-def」が次の行に送られます。</dd>
<dt>改行をしないスペース^s</dt>
<dd>見た目は通常の半角スペースですが改行しません。例えば「abc def」が右端にあると「abc 」で切れて「def」は次の行に送られます。しかし改行をしないスペースを使うと途中で切れず「abc def」が次の行に送られます。</dd>
<dt>任意指定のハイフン^-</dt>
<dd>「¬」という記号です。</dd>
<dt>セクション区切り^b</dt>
<dd>「セクション区切り」はページレイアウトなどをファイルの途中から変更するために使われます。「:::::セクション区切り(●●から新しいセクション):::::」のように表示されます。メニューの ページレイアウト &#8211; ページ設定 &#8211; 区切り &#8211; 次のページから開始 などを選択してセットします。</dd>
<dt>全角または半角の空白^w</dt>
<dd>全角スペースと半角スペースの両方が該当します。また連続するスペースが対象になります。</dd>
</dl>
]]></content:encoded>
					
					<wfw:commentRss>https://stabucky.com/wp/archives/9242/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Wordで西暦年月日を挿入するマクロ</title>
		<link>https://stabucky.com/wp/archives/8742</link>
					<comments>https://stabucky.com/wp/archives/8742#respond</comments>
		
		<dc:creator><![CDATA[stabucky]]></dc:creator>
		<pubDate>Thu, 10 Nov 2016 13:59:53 +0000</pubDate>
				<category><![CDATA[Word]]></category>
		<category><![CDATA[VBA]]></category>
		<category><![CDATA[日付]]></category>
		<guid isPermaLink="false">http://stabucky.com/wp/?p=8742</guid>

					<description><![CDATA[Wordには今日の日付を挿入する機能があります。 メニューの 挿入 &#8211; テキスト &#8211; 日付と時刻 を選択します(Word2013の場合)。 デフォルトではキーボードショートカットとして「Ctrl+ [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Wordには今日の日付を挿入する機能があります。<br />
メニューの 挿入 &#8211; テキスト &#8211; 日付と時刻 を選択します(Word2013の場合)。<br />
デフォルトではキーボードショートカットとして「Ctrl+;」(Ctrlキーを押しながらセミコロンキー)が割り当てられています。<br />
しかし「日付と時刻」ダイアログが表示され、表示形式を選択する必要があります。またファイルによっては言語の選択が英語になってしまう場合があります。<br />
私は西暦年月日だけを挿入したいので不便です。<br />
マクロを作りました。<span id="more-8742"></span></p>
<div class="codecolorer-container text dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:400px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">Sub 西暦年月日を挿入()<br />
&nbsp; &nbsp; Selection.TypeText Text:=Format(Now(), &quot;yyyy年m月d日&quot;)<br />
End Sub</div></div>
<p>また「Ctrl+;」にこのマクロを割り当てることもできます。<br />
<a href="https://stabucky.com/wp/archives/3409" target="_blank">Wordでショートカットキーを設定 | You Look Too Cool</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://stabucky.com/wp/archives/8742/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Wordで表と表の間に改行を挿入する</title>
		<link>https://stabucky.com/wp/archives/8100</link>
					<comments>https://stabucky.com/wp/archives/8100#respond</comments>
		
		<dc:creator><![CDATA[stabucky]]></dc:creator>
		<pubDate>Thu, 19 May 2016 21:10:32 +0000</pubDate>
				<category><![CDATA[Word]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[表]]></category>
		<guid isPermaLink="false">http://stabucky.com/wp/?p=8100</guid>

					<description><![CDATA[Wordで二つの表が縦に並んでいて、これらの間に隙間がないとします。 このような場合に表と表の間に改行を挿入して隙間(空行)を作る方法です。Word2013で確認しました。 二つの表のうち、下の表の先頭行にカーソルを移動 [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Wordで二つの表が縦に並んでいて、これらの間に隙間がないとします。<br />
このような場合に表と表の間に改行を挿入して隙間(空行)を作る方法です。Word2013で確認しました。</p>
<ol>
<li>二つの表のうち、下の表の先頭行にカーソルを移動する。</li>
<li>メニューの 表ツール &#8211; レイアウト &#8211; 結合 &#8211; 表の分割 を選択。</li>
</ol>
<p>これで下の表の上に空行ができます。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://stabucky.com/wp/archives/8100/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>いい感じにできたスタイルを他のWord文書に適用する方法</title>
		<link>https://stabucky.com/wp/archives/7946</link>
					<comments>https://stabucky.com/wp/archives/7946#respond</comments>
		
		<dc:creator><![CDATA[stabucky]]></dc:creator>
		<pubDate>Tue, 02 Feb 2016 23:53:00 +0000</pubDate>
				<category><![CDATA[Word]]></category>
		<category><![CDATA[tips]]></category>
		<guid isPermaLink="false">http://stabucky.com/wp/?p=7946</guid>

					<description><![CDATA[Wordにはスタイルセットという機能があります。 メニュー(リボン)の「デザイン」タブの「ドキュメントの書式設定」にある「スタイルセット」に17種類の「組み込み」のスタイルセットが用意されています。 Wordで文書を作成 [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Wordにはスタイルセットという機能があります。<br />
メニュー(リボン)の「デザイン」タブの「ドキュメントの書式設定」にある「スタイルセット」に17種類の「組み込み」のスタイルセットが用意されています。<br />
Wordで文書を作成する際に「表題」や「見出し」などのスタイルを適切に使用している場合、スタイルセットを使うと、スタイルに応じてフォントやレイアウトをまとめて変えることができます。統一感があるので美しく見えます。<span id="more-7946"></span></p>
<p>スタイルはユーザーが自由に設定することができます。<br />
いい感じのスタイルができた場合は他のWord文書にも適用したくなります。<br />
ユーザーが設定したスタイルセットを保存する方法を紹介します。Word2013で確認しました。</p>
<ol>
<li>メニューのデザイン-ドキュメントの書式設定-スタイルセット-その他(右下の下向き三角▼)をクリック。</li>
<li>「新しいスタイルセットとして保存」を選択。</li>
<li>「新しいスタイルセットとして保存」ダイアログで、ファイル名を入力、ファイルの種類は「Wordテンプレート」とする。</li>
<li>保存をクリック</li>
</ol>
<p>次回からはスタイルセットの中に「ユーザー設定」として先ほど保存したスタイルが表示されます。</p>
<p><a href='http://www.amazon.co.jp/exec/obidos/ASIN/4295005541/saigohaundesu-22'><img src='http://images-jp.amazon.com/images/P/4295005541.09.LZZZZZZZ.jpg'></a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://stabucky.com/wp/archives/7946/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>複数のWord文書に対して文字列置換</title>
		<link>https://stabucky.com/wp/archives/7897</link>
					<comments>https://stabucky.com/wp/archives/7897#comments</comments>
		
		<dc:creator><![CDATA[stabucky]]></dc:creator>
		<pubDate>Tue, 12 Jan 2016 12:49:25 +0000</pubDate>
				<category><![CDATA[Word]]></category>
		<category><![CDATA[VBA]]></category>
		<guid isPermaLink="false">http://stabucky.com/wp/?p=7897</guid>

					<description><![CDATA[フォルダを指定し、その中のWord文書に対して、文字列の置換をするマクロです。 まず置換前の文字列と置換後の文字列を入力します。 その後、フォルダを選択します。 実行されるとファイルを開き置換を行い上書き保存します。これ [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>フォルダを指定し、その中のWord文書に対して、文字列の置換をするマクロです。<br />
まず置換前の文字列と置換後の文字列を入力します。<br />
その後、フォルダを選択します。<br />
実行されるとファイルを開き置換を行い上書き保存します。これを繰り返します。<span id="more-7897"></span></p>
<div class="codecolorer-container vb dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:400px;height:400px;"><div class="vb codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #E56717; font-weight: bold;">Sub</span> 複数文書連続処理_文字列置換()<br />
&nbsp; &nbsp; <span style="color: #008000;">'置換文字列の指定</span><br />
&nbsp; &nbsp; mae = InputBox(<span style="color: #800000;">&quot;置換前の文字列を入力してください。&quot;</span>, <span style="color: #800000;">&quot;置換前&quot;</span>)<br />
&nbsp; &nbsp; <span style="color: #8D38C9; font-weight: bold;">If</span> mae = <span style="color: #800000;">&quot;&quot;</span> <span style="color: #8D38C9; font-weight: bold;">Then</span> <span style="color: #E56717; font-weight: bold;">Exit</span> <span style="color: #E56717; font-weight: bold;">Sub</span><br />
&nbsp; &nbsp; ato = InputBox(<span style="color: #800000;">&quot;置換後の文字列を入力してください。&quot;</span>, <span style="color: #800000;">&quot;置換後&quot;</span>)<br />
&nbsp; &nbsp; <span style="color: #8D38C9; font-weight: bold;">If</span> ato = <span style="color: #800000;">&quot;&quot;</span> <span style="color: #8D38C9; font-weight: bold;">Then</span> <span style="color: #E56717; font-weight: bold;">Exit</span> <span style="color: #E56717; font-weight: bold;">Sub</span><br />
&nbsp; &nbsp; <span style="color: #008000;">'フォルダの選択</span><br />
&nbsp; &nbsp; <span style="color: #8D38C9; font-weight: bold;">With</span> Application.FileDialog(msoFileDialogFolderPicker)<br />
&nbsp; &nbsp; &nbsp; &nbsp; .Title = <span style="color: #800000;">&quot;フォルダを選択&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; .AllowMultiSelect = <span style="color: #00C2FF; font-weight: bold;">False</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #8D38C9; font-weight: bold;">If</span> .Show = -1 <span style="color: #8D38C9; font-weight: bold;">Then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mypath = .SelectedItems(1) &amp; <span style="color: #800000;">&quot;\&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #8D38C9; font-weight: bold;">Else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MsgBox <span style="color: #800000;">&quot;終了します。&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #E56717; font-weight: bold;">Exit</span> <span style="color: #E56717; font-weight: bold;">Sub</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span><br />
&nbsp; &nbsp; <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">With</span><br />
&nbsp; &nbsp; <span style="color: #008000;">'実行</span><br />
&nbsp; &nbsp; res = MsgBox(mypath &amp; <span style="color: #800000;">&quot;のフォルダ内のWord文書について「&quot;</span> &amp; mae &amp; <span style="color: #800000;">&quot;」を「&quot;</span> &amp; ato &amp; <span style="color: #800000;">&quot;」に置換します。よろしいですか。&quot;</span>, vbOKCancel)<br />
&nbsp; &nbsp; <span style="color: #8D38C9; font-weight: bold;">If</span> res = vbCancel <span style="color: #8D38C9; font-weight: bold;">Then</span> <span style="color: #E56717; font-weight: bold;">Exit</span> <span style="color: #E56717; font-weight: bold;">Sub</span><br />
&nbsp; &nbsp; myfile = Dir(mypath &amp; <span style="color: #800000;">&quot;*.doc*&quot;</span>)<br />
&nbsp; &nbsp; <span style="color: #8D38C9; font-weight: bold;">Do</span> <span style="color: #8D38C9; font-weight: bold;">While</span> myfile &lt;&gt; <span style="color: #800000;">&quot;&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Documents.<span style="color: #151B8D; font-weight: bold;">Open</span> FileName:=mypath &amp; myfile<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #E56717; font-weight: bold;">Call</span> 文書全体を置換(mae, ato)<br />
&nbsp; &nbsp; &nbsp; &nbsp; ActiveWindow.<span style="color: #8D38C9; font-weight: bold;">Close</span> SaveChanges:=wdSaveChanges<br />
&nbsp; &nbsp; &nbsp; &nbsp; myfile = Dir<br />
&nbsp; &nbsp; <span style="color: #8D38C9; font-weight: bold;">Loop</span><br />
<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Sub</span><br />
<span style="color: #E56717; font-weight: bold;">Function</span> 文書全体を置換(mae, ato)<br />
&nbsp; &nbsp; <span style="color: #151B8D; font-weight: bold;">Set</span> myRange = ActiveDocument.Range(Start:=0, <span style="color: #8D38C9; font-weight: bold;">End</span>:=0)<br />
&nbsp; &nbsp; <span style="color: #8D38C9; font-weight: bold;">With</span> myRange.Find<br />
&nbsp; &nbsp; &nbsp; &nbsp; .ClearFormatting<br />
&nbsp; &nbsp; &nbsp; &nbsp; .Text = mae<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #8D38C9; font-weight: bold;">With</span> .Replacement<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .ClearFormatting<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .Text = ato<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">With</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; .Execute Replace:=wdReplaceAll<br />
&nbsp; &nbsp; <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">With</span><br />
<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Function</span></div></div>
]]></content:encoded>
					
					<wfw:commentRss>https://stabucky.com/wp/archives/7897/feed</wfw:commentRss>
			<slash:comments>16</slash:comments>
		
		
			</item>
	</channel>
</rss>
