Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Lako
 
Posts: n/a
Default Word 2003 Selection or Range Objects

I have a large document of 270 pages. I need to save each page as a separate
rtf file. I tried recording a macro and modifying it to iterate through all
the pages selecting, copying and saving as a new document, but the selection
starting from the beginning of the page using shift & ctrl-pgdn-pgdn would
not select the page when used in the macro (it did fine when using it from
the keyboard). I do not understand how to make the selection in VBA using the
range or selection objects. Any help in how to set the selection for a page
would be much appreciated
--
Thanks much
Lako
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Cooz
 
Posts: n/a
Default Word 2003 Selection or Range Objects

Hi Lako,

Use this macro:

Sub MakeDocs()
Const strSaveDir As String = "G:\temp"
Dim intN As Integer, strN As String

For intN = 1 To ActiveDocument.BuiltInDocumentProperties(wdPropert yPages)
strN = LTrim(Str(intN))

Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:=strN
ActiveDocument.Bookmarks("\Page").Select
Selection.Copy

Documents.Add
Selection.Paste
ActiveDocument.SaveAs FileName:=strSaveDir & "\RTFDoc" & strN &
".rtf", _
FileFormat:=wdFormatRTF, AddToRecentFiles:=False
ActiveDocument.Close

Next intN

End Sub

Substitute "G:\temp" for the directory in which yout rtf documents are to be
saved. Be sure your 270 page document is the active document when you run the
macro. The macro creates filenames like "RTFDoc1.rtf", "RTFDoc2.rtf" and so
on. The files are based on Normal dot. If you set the default margins
slightly wider or the default font size somewhat smaller, you prevent
creating a blank second page.

Good luck,
Cooz
--
PS: If this is a satisfying answer to your question and you're logged in via
the Microsoft site, please click Yes to "Did this post answer the question?".
Thanks.

"Lako" wrote:

I have a large document of 270 pages. I need to save each page as a separate
rtf file. I tried recording a macro and modifying it to iterate through all
the pages selecting, copying and saving as a new document, but the selection
starting from the beginning of the page using shift & ctrl-pgdn-pgdn would
not select the page when used in the macro (it did fine when using it from
the keyboard). I do not understand how to make the selection in VBA using the
range or selection objects. Any help in how to set the selection for a page
would be much appreciated
--
Thanks much
Lako

  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Lako
 
Posts: n/a
Default Word 2003 Selection or Range Objects

Cooz

I am up and running.
--
Thanks for the help.
Lako


"Cooz" wrote:

Hi Lako,

Use this macro:

Sub MakeDocs()
Const strSaveDir As String = "G:\temp"
Dim intN As Integer, strN As String

For intN = 1 To ActiveDocument.BuiltInDocumentProperties(wdPropert yPages)
strN = LTrim(Str(intN))

Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:=strN
ActiveDocument.Bookmarks("\Page").Select
Selection.Copy

Documents.Add
Selection.Paste
ActiveDocument.SaveAs FileName:=strSaveDir & "\RTFDoc" & strN &
".rtf", _
FileFormat:=wdFormatRTF, AddToRecentFiles:=False
ActiveDocument.Close

Next intN

End Sub

Substitute "G:\temp" for the directory in which yout rtf documents are to be
saved. Be sure your 270 page document is the active document when you run the
macro. The macro creates filenames like "RTFDoc1.rtf", "RTFDoc2.rtf" and so
on. The files are based on Normal dot. If you set the default margins
slightly wider or the default font size somewhat smaller, you prevent
creating a blank second page.

Good luck,
Cooz
--
PS: If this is a satisfying answer to your question and you're logged in via
the Microsoft site, please click Yes to "Did this post answer the question?".
Thanks.

"Lako" wrote:

I have a large document of 270 pages. I need to save each page as a separate
rtf file. I tried recording a macro and modifying it to iterate through all
the pages selecting, copying and saving as a new document, but the selection
starting from the beginning of the page using shift & ctrl-pgdn-pgdn would
not select the page when used in the macro (it did fine when using it from
the keyboard). I do not understand how to make the selection in VBA using the
range or selection objects. Any help in how to set the selection for a page
would be much appreciated
--
Thanks much
Lako

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
take yet another lesson from wordperfect "reveal codes" wordperfect is superior Microsoft Word Help 5 May 11th 09 07:58 PM
Word should allow to 'divide' page by 3 or 4, not just 2 CandasK Page Layout 2 February 28th 06 11:16 PM
Does Word have a QuickCorrect/Quick Word option like WordPerfect? CW New Users 2 December 20th 05 06:54 PM
In Word, how do I surpress headers and footers on page 2 Bill Microsoft Word Help 1 December 15th 05 07:13 PM
Envelope Address GR New Users 5 April 24th 05 09:48 PM


All times are GMT +1. The time now is 04:18 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"