elreymon
elreymon

Reputation: 1

VBComponent.SaveAs object doesn't support this property or method

Compiler says than Componente.SaveAs object doesn't support this property or method. Microsoft Help: https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/saveas-method-vba-add-in-object-model

In C:\Program Files\Microsoft Office\root\vfs\ProgramFilesCommonX86\Microsoft Shared\VBA\VBA7.1\1033\VBOB6.CHM you can see the Applies To lists and it clearly says that SaveAs method applies to VBComponent Object.

¿Can anyone help with this error? Thanks in advance

I´m writing a macro in VBA so that Word can save a standard Module (only code; not a class module) to a path in filesystem.

   For Each Componente In ThisDocument.VBProject.VBComponents
        If StrComp(Componente.Name, Modulo1Nombre) = 0 Then 'https://learn.microsoft.com/en-us/office/vba/language/reference/visual-basic-add-in-model/properties-visual-basic-add-in-model#name
            MsgBox "Encontrado módulo. Salvando en: " + PATH_BACKUP + Modulo1Nombre + EXTENSION_DE_MODULO
            Componente.SaveAs (PATH_BACKUP + Modulo1Nombre + EXTENSION_DE_MODULO)
            Exit For ' Una vez encontrado salimos
        End If
    Next Componente

Upvotes: 0

Views: 29

Answers (0)

Related Questions