久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

應(yīng)用VBA將長(zhǎng)文檔word按大綱級(jí)別拆分為新文件并另存為PDF

 王淼個(gè)人館 2022-08-31 發(fā)布于山東

'將長(zhǎng)文檔中的同一級(jí)別的內(nèi)容分別拆分為一個(gè)新文件,,并同時(shí)以新文件內(nèi)容第一行為文件名保存在當(dāng)前文件夾中。

Sub 按大綱級(jí)別拆分文件()

Dim rngrange As Range

Dim doc As Document

Dim i As Integer

Dim j As Integer

Dim mys As String

Dim levi As Integer

Dim levj As Integer

Dim contt As String

Dim spendtimestr As String

Application.ScreenUpdating = False

mypath = ActiveDocument.Path

starttime = Time

For i = 1 To ActiveDocument.Paragraphs.Count

If ActiveDocument.Range.Paragraphs(i).OutlineLevel = wdOutlineLevel2 Then

levi = ActiveDocument.Range.Paragraphs(i).OutlineLevel

Set myRange = ActiveDocument.Paragraphs(i).Range

myRange.SetRange myRange.Start, myRange.End - 1

iFilename = Trim(myRange.Text)

j = i 'J等于i,即找到目標(biāo)的段落,,關(guān)鍵點(diǎn)之一

Do

'從即找到目標(biāo)的段落i開(kāi)始,,依次往后找,一直到找到級(jí)別小于或等于目標(biāo)段落的段落或找到文章的最后,,關(guān)鍵點(diǎn)之二

j = j + 1

levj = ActiveDocument.Range.Paragraphs(j).OutlineLevel

Loop Until (levj < levi Or levj = levi Or j = ActiveDocument.Paragraphs.Count)

'級(jí)別小于或等于目標(biāo)段落的段落或找到文章的最后,,關(guān)鍵點(diǎn)之三

'如果是件末,則將最后一段內(nèi)容同時(shí)拷貝

If j = ActiveDocument.Paragraphs.Count Then

Set rngrange = ActiveDocument.Range(ActiveDocument.Paragraphs(i).Range.Start, ActiveDocument.Paragraphs(j).Range.End)

rngrange.Select

Selection.Copy

Else

Set rngrange = ActiveDocument.Range(ActiveDocument.Paragraphs(i).Range.Start, ActiveDocument.Paragraphs(j - 1).Range.End)

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,,所有內(nèi)容均由用戶(hù)發(fā)布,,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式,、誘導(dǎo)購(gòu)買(mǎi)等信息,,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,,請(qǐng)點(diǎn)擊一鍵舉報(bào),。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶(hù) 評(píng)論公約

    類(lèi)似文章 更多