Bonjour,

J'ai un fichier d'un applicatif, que j'ouvre avec word et que je reformate via la macro ci-dessous. Tout le texte est selectionné, mise en page format paysage, et police de 8 pour tout le texte, mais lorsque la sauvegarde se fait à la fin, et que je veux visionner mon fichier, il est en format portrait, en police 12 ?
Pourtant à l'écran avant la sauvegarde, tout est bon. Le problème se fait à la sauvegarde.
Comment modifier cette macro pour que tout se fasse comme que je le souhaite ?

Merci d'avance.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Shell "C:\Codex regionnal CV01\TransfertCODEX.exe"
ChangeFileOpenDirectory "U:\WorkArea\Application Data\BANK\Codex\"
    Documents.Open FileName:="TRANFERT.RES", ConfirmConversions:=False, _
        ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
        PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
        WritePasswordTemplate:="", Format:=wdOpenFormatAuto, Encoding:=1252
    With ActiveDocument.Styles(wdStyleNormal).Font
        If .NameFarEast = .NameAscii Then
            .NameAscii = ""
        End If
        .NameFarEast = ""
    End With
    With ActiveDocument.PageSetup
        .LineNumbering.Active = False
        .Orientation = wdOrientLandscape
        .TopMargin = CentimetersToPoints(2.03)
        .BottomMargin = CentimetersToPoints(2.03)
        .LeftMargin = CentimetersToPoints(2.5)
        .RightMargin = CentimetersToPoints(2.5)
        .Gutter = CentimetersToPoints(0)
        .HeaderDistance = CentimetersToPoints(1.25)
        .FooterDistance = CentimetersToPoints(1.25)
        .PageWidth = CentimetersToPoints(29.7)
        .PageHeight = CentimetersToPoints(21)
        .FirstPageTray = wdPrinterDefaultBin
        .OtherPagesTray = wdPrinterDefaultBin
        .SectionStart = wdSectionNewPage
        .OddAndEvenPagesHeaderFooter = False
        .DifferentFirstPageHeaderFooter = False
        .VerticalAlignment = wdAlignVerticalTop
        .SuppressEndnotes = False
        .MirrorMargins = False
        .TwoPagesOnOne = False
        .BookFoldPrinting = False
        .BookFoldRevPrinting = False
        .BookFoldPrintingSheets = 1
        .GutterPos = wdGutterPosLeft
        .LayoutMode = wdLayoutModeDefault
    End With
    Selection.Delete Unit:=wdCharacter, Count:=1
    Windows(2).Activate
    Selection.WholeStory
    Selection.Font.Size = 8
    Selection.MoveLeft Unit:=wdCharacter, Count:=1
    Selection.MoveDown Unit:=wdLine, Count:=6
    Selection.MoveRight Unit:=wdCharacter, Count:=83
    Selection.MoveRight Unit:=wdCharacter, Count:=5, Extend:=wdExtend
    With ActiveDocument.Bookmarks
        .Add Range:=Selection.Range, Name:="Nomsauvegarde"
        .DefaultSorting = wdSortByName
        .ShowHidden = False
        End With
   Dim bb As Word.Bookmark
 
Set bb = ActiveDocument.Bookmarks("Nomsauvegarde")
       ActiveDocument.SaveAs "U:\WorkArea\Application Data\BANK\Codex\" & bb.Range.Text
MsgBox "Votre fichier a été enregistré sous U:\WorkArea\Application Data\BANK\Codex"
ActiveDocument.Close
End Sub