Skip to main content
Question

Macro does not execute in IFS Cloud

  • Dec 3, 2026 12:17 PM UTC
  • 0 replies
  • 6 views

Forum|alt.badge.img+7

Hola ​@Mathias Dahl

 ​​​I’ve seen in the community that you’re an expert in macros!!!

I have created a macro in IFS Cloud to add the string ‘CODDOC-’ and the document revision no to the Word document that is downloaded. Steps:

  1. Document Macro Block: I create the macro:
    1. Public Sub AppendCODDOC_AtEnd()
          MsgBox (Run AppendCODDOC_AtEnd)
          Dim filename, wdApp, wdDoc, nrodoc
          filename = Replace(ClientScriptValues.Item("LOCAL_FILE_1").Value, "/", "\")
          Set wdApp = CreateObject("Word.Application")
         wdApp.Visible = True
          Set wdDoc = wdApp.Documents.Open(filename)
          nrodoc = CStr(ScriptValues.Item("DOC_NO").Value)
          ' Ir al inicio
          wdApp.Selection.HomeKey 6  ' wdStory
          ' Insertar texto
          wdApp.Selection.TypeText "CODDOC-" & nrodoc
          wdApp.Selection.TypeParagraph
          ' Volver al inicio y seleccionar la línea insertada
          wdApp.Selection.HomeKey 6
          wdApp.Selection.EndKey 5  ' wdLine
          wdApp.Selection.MoveLeft 1, Len("CODDOC-" & nrodoc), 1  ' Seleccionar
           ' Aplicar color blanco
          wdApp.Selection.Font.Color = 16777215
          wdApp.Selection.Font.Size = 1
           ' Deseleccionar
          wdApp.Selection.HomeKey 6
          wdDoc.Save

      End Sub

  1. I crete the File Type (WORDM)
  1. Document Macros
  1. Document Class Management, on Macros tab, I created the process Checkout with WORDM File type.
  1. Document Class Management, on Format tab, I create the format: EJEC01
  1. Document File Template for the EJEC01 format
  1. The document I need to attach, for example in Functional Object, is a document saved as a template.
  2. In Functional Object, I attach a new document using a template
  3. I’ve downloaded the macro to edit it, but it doesn’t seem to be running because neither the word ‘CODDOC-’ appears nor is the message (MagBox) displayed (the document doesn’t open automatically; it downloads to the ‘Downloads’ folder and I open it manually).

IFS Cloud 24R2, Edge navigator and with Aurena Agent active (but I don’t know if the problem is the Aurena Agent or the Print Agent)

Any ideas?

Thank you in advance