Une fois la macro lancée, affichage auto de "brouillon" VBA-Word

Résolu/Fermé
Arthyss Messages postés 22 Date d'inscription mercredi 22 mars 2017 Statut Membre Dernière intervention 28 avril 2017 - Modifié le 28 mars 2017 à 12:13
Arthyss Messages postés 22 Date d'inscription mercredi 22 mars 2017 Statut Membre Dernière intervention 28 avril 2017 - 28 mars 2017 à 12:17
Bonjour,

Sur word, j'ai effectué une macro permettant d'écrire automatiquement le pied de page, j'en ai ensuite créé une pour la mettre en forme.

lors du lancement de la 2nd je me retrouve dans la partie "brouillon", c'est super relou
d'où pourrait venir mon problème?

"bouillon" :


"Ma page normale":



Sub Pied_de_page()
    ThisDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range.InsertBefore "STELIA AEROSPACE COMPOSITES - S.A.S au capital de 1 441 160€ - 330 316 381 RCS BORDEAUX - SIRET 330 316 381 00012 - APE 3030 Z - TVA FR 65 330316381" & _
    vbCrLf & "Siège social - 19, route de Lacanau - 33160 Salaunes - France -Tél. 33 (0)5 56 68 55 00 - Télécopieurs: Général 33 (0)5 56 58 51 93 - Service Supply Chain: 33 (0)5 56 68 55 38"
    
    mise_en_forme_pied_page

End Sub


Sub mise_en_forme_pied_page()
 
   
    '********** Mise en forme du pied de page **********
    ThisDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range.Select
    'taille de la police
    Selection.Font.Size = 9
    
    'longueur
    With Selection.ParagraphFormat
        .LeftIndent = CentimetersToPoints(-2.25)
        .RightIndent = CentimetersToPoints(-2.25)
        .SpaceBefore = 0
        .SpaceBeforeAuto = False
        .SpaceAfter = 0
        .SpaceAfterAuto = False
        .LineSpacingRule = wdLineSpaceMultiple
        .LineSpacing = LinesToPoints(1.15)
        .Alignment = wdAlignParagraphLeft
        .WidowControl = True
        .KeepWithNext = False
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = CentimetersToPoints(0)
        .OutlineLevel = wdOutlineLevelBodyText
        .CharacterUnitLeftIndent = 0
        .CharacterUnitRightIndent = 0
        .CharacterUnitFirstLineIndent = 0
        .LineUnitBefore = 0
        .LineUnitAfter = 0
        .MirrorIndents = False
        .TextboxTightWrap = wdTightNone
    End With

     
End Sub
A voir également:

1 réponse

Arthyss Messages postés 22 Date d'inscription mercredi 22 mars 2017 Statut Membre Dernière intervention 28 avril 2017 5
Modifié le 28 mars 2017 à 12:32
Par le plus grand des hasard j'ai trouvé
Si ça peut aider, il faut écrire :
 
sub main()
ActiveWindow.View.SplitSpecial = wdPaneNone
... ' Votre code
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument 'revenir sur la page word
ActiveWindow.View.Type = wdPrintView 'quitter le brouillon 
end sub
0