Batch macro to change to A4

C

CJ

Hi, I need to change the page setup>paper size in several hundred docs to
A4. Is there a macro available from someone to help with this? Appreciate any
help.
Chuck
 
D

Doug Robbins

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
 
C

CJ

Thanks for your help.
CJ

Doug Robbins said:
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
 
Top