Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Tópicos relacionados a códigos VBA, gravação de macros, etc.
#71437
Preciso salvar partes selecionadas de um um arquivo Word em outro arquivo Word com marca d'agua e cabeçalho e depois salvar em PDF

já tenho esse código que mesclei pela internet, porém da erro no final
Código: Selecionar todos
Sub SaveCurrentPageAsANewDoc()
 
    Dim xDoc As Document
    Dim xNewDoc As Document
    Dim xFileName As String
    Dim xFolderPath As Variant
    Dim xDlg As FileDialog
    Dim Words As Object
    
    Set xDoc = ActiveDocument
    
    xFileName = InputBox("Enter file name here: ", "KuTools for Word")
    
    If xFileName = "" Then Exit Sub
    
    Set xDlg = Application.FileDialog(msoFileDialogFolderPicker)
    
    If xDlg.Show = -1 Then
    
        xFolderPath = xDlg.SelectedItems(1)
        xDoc.Bookmarks("\Page").Range.Select
        Selection.Copy
        
        Set Words = CreateObject("Word.Application")
        Words.Documents.Open "C:\Users\AVSPC03\Desktop\Produtos AVS word\Modelo1.docx"
        
        Selection.Paste
        Word.SaveAs xFolderPath & "\" & xFileName & ".PDF"   (Nessa parte ta dando erro)
        Words.Close
        
    End If
End Sub 
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord