Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Batch macro to change to A4
Hi, I need to change the page setuppaper size in several hundred docs to
A4. Is there a macro available from someone to help with this? Appreciate any help. Chuck |
#2
|
|||
|
|||
The following code should do it:
Dim MyPath As String Dim MyFileName As String Dim Source As Document With Dialogs(wdDialogCopyFile) If .Display() -1 Then Exit Sub MyPath = .Directory End With If Len(MyPath) = 0 Then Exit Sub If Asc(MyPath) = 34 Then MyPath = Mid$(MyPath, 2, Len(MyPath) - 2) End If MyFileName = Dir$(MyPath & "*.doc") While MyName "" Set Source = Documents.Open(MyPath & myFile) Source.PageSetup.PaperSize = wdPaperA4 Source.Save Source.Close MyName = Dir Wend -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "CJ" wrote in message ... Hi, I need to change the page setuppaper size in several hundred docs to A4. Is there a macro available from someone to help with this? Appreciate any help. Chuck |
#3
|
|||
|
|||
Thanks for your help.
CJ "Doug Robbins" wrote: The following code should do it: Dim MyPath As String Dim MyFileName As String Dim Source As Document With Dialogs(wdDialogCopyFile) If .Display() -1 Then Exit Sub MyPath = .Directory End With If Len(MyPath) = 0 Then Exit Sub If Asc(MyPath) = 34 Then MyPath = Mid$(MyPath, 2, Len(MyPath) - 2) End If MyFileName = Dir$(MyPath & "*.doc") While MyName "" Set Source = Documents.Open(MyPath & myFile) Source.PageSetup.PaperSize = wdPaperA4 Source.Save Source.Close MyName = Dir Wend -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "CJ" wrote in message ... Hi, I need to change the page setuppaper size in several hundred docs to A4. Is there a macro available from someone to help with this? Appreciate any help. Chuck |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to change section headers and footers in a macro? | Page Layout | |||
Macro Button Won't Stay on Toolbar | Microsoft Word Help | |||
Possible bug when recording a Word Macro | Microsoft Word Help | |||
Change name of button that runs macro | Microsoft Word Help | |||
2000 to 2002 macro and "Could not open macro storage" | Mailmerge |