USUÁRIO:      SENHA:        SALVAR LOGIN ?    Adicione o VBWEB na sua lista de favoritos   Fale conosco 

 

  Fórum

  Visual Basic
Voltar
Autor Assunto:  MsWord versões até 2013: Como inserir um cabeçalho
LAURÃO
TUCURUÍ
PA - BRASIL
Postada em 03/03/2019 10:50 hs            
Fiz alguns ajustes no código anteriormente enviado e obtive exito na inserção de cabeçalho, utilizando a seguinte rotina:
Dim Word_VB As New Word.Application

Word_VB.Documents.Add

Word_VB.Visible = True

With Word_VB
  .Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
  .Selection.Font.Size = 14
  .Selection.Font.Bold = True
  .Selection.TypeText Text:="" & UCase(Text4.Text)
  .Selection.TypeParagraph
  .Selection.Font.Size = 12
  .Selection.TypeParagraph
  .Selection.TypeParagraph
  .Selection.Font.Size = 10
  .Selection.Font.Italic = True
End With

' Inserção de cabeçalho--------------------------------------

If Text5.Text <> "" Then

Dim Cabecintervalo As Range
    
    Set Cabecintervalo = Word_VB.ActiveDocument.Sections.Item(1).Headers(wdHeaderFooterPrimary).Range
        With Cabecintervalo
            .Text = "" & Text5.Text
            .ParagraphFormat.Alignment = wdAlignParagraphCenter
            .Font.Name = "Arial"
            .Font.Size = 12
            .Font.Bold = True
            .Font.Shadow = True
            .Font.ColorIndex = wdBlue

        End With

End If

'------------------------------------------------------

Word_VB.Documents(Word_VB.ActiveDocument).SaveAs2 Text3.Text & Text1.Text & ".docx"
    Word_VB.Quit
    Set Word_VB = Nothing

MsgBox "O documento " & Text1.Text & " foi criado com sucesso e arquivado em: " & Text3.Text, vbInformation

Té +
TÓPICO EDITADO
   
Página(s): 1/1    


Seu Nome:

Seu eMail:

ALTERAR PARA MODO HTML
Mensagem:

[:)] = 
[:P] = 
[:(] = 
[;)] = 

HTML DESLIGADO

     
 VOLTAR

  



CyberWEB Network Ltda.    © Copyright 2000-2024   -   Todos os direitos reservados.
Powered by HostingZone - A melhor hospedagem para seu site
Topo da página