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:
- Document Macro Block: I create the macro:
-
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.SaveEnd Sub
-
- I crete the File Type (WORDM)
- Document Macros
- Document Class Management, on Macros tab, I created the process Checkout with WORDM File type.
- Document Class Management, on Format tab, I create the format: EJEC01
- Document File Template for the EJEC01 format
- The document I need to attach, for example in Functional Object, is a document saved as a template.
- In Functional Object, I attach a new document using a template
- 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