Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 04-13-2023, 04:04 PM
gmaxey gmaxey is offline Selecting Text within a document with known start/stop (+searching and tools) Windows 10 Selecting Text within a document with known start/stop (+searching and tools) Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,636
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Actually you weren't doing anything right.



Code:
Sub SplitDocumentTest()
Dim oRng As Range
Dim oDoc As Document

  Set oRng = ActiveDocument.Range
  With oRng
    .Collapse wdCollapseStart
    .EndOf Unit:=wdSection, Extend:=wdExtend
    .MoveEnd wdCharacter, -1
    Set oDoc = Documents.Add()
    .Copy
    oDoc.Content.Paste
    oDoc.SaveAs2 FileName:="Specification_1", FileFormat:=wdFormatXMLDocument
    Set oDoc = Nothing
    .Collapse wdCollapseEnd
    .MoveStart wdCharacter, 1
    .EndOf Unit:=wdSection, Extend:=wdExtend
    .MoveEnd wdCharacter, -1
    Set oDoc = Documents.Add()
    .Copy
    oDoc.Content.Paste
    oDoc.SaveAs2 FileName:="Specification_2", FileFormat:=wdFormatXMLDocument
    Set oDoc = Nothing
    .Collapse wdCollapseEnd
    .MoveStart wdCharacter, 1
    .EndOf Unit:=wdSection, Extend:=wdExtend
    .MoveEnd wdCharacter, -1
    Set oDoc = Documents.Add()
    .Copy
    oDoc.Content.Paste
    oDoc.SaveAs2 FileName:="Specification_3", FileFormat:=wdFormatXMLDocument
    Set oDoc = Nothing
  End With
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 

Tags
resources, select text

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Searching in main body document and text boxes at the same time laith93 Word VBA 0 10-31-2021 10:38 AM
Searching for e-mails in a Shared Mailbox prior to start date. m5fgn Outlook 4 08-08-2019 03:43 AM
Selecting Text within a document with known start/stop (+searching and tools) Change Drawing Tools to Text Box Tools to insert address in labels Alecf Drawing and Graphics 5 09-01-2017 05:27 AM
Start and stop an executeble from vba remmyMartin Outlook 0 01-12-2012 08:09 AM
Selecting Text within a document with known start/stop (+searching and tools) Remove text in start up document Sheila Word 1 09-30-2010 03:33 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:49 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft