0

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
braX
  • 11,506
  • 5
  • 20
  • 33
elreymon
  • 1
  • 2
  • `Componente.Export`. – BigBen Dec 21 '22 at 18:33
  • If you install Rubberduck, the free and fantastic open source addin for VBA, the ability to export a project in a couple of clicks, in addition to may other wonderful tools. – freeflow Dec 21 '22 at 21:52

0 Answers0