I would like to use a macro in vba on excel, to extract a file when opening it, save it and then archive it.
At the moment, I know how to extract a file via a macro (with unlock_file) the same to archive, but I don't know how to extract the open file and archive this same file. The file is open and cannot be archived.
I think there is a solution since I have the Enterprise PDM add-in that allows me to do this with the click of a button.
Hello, I may misunderstand the question but why do this? You can simply "extract" and then "archive" directly from the vault. otherwise in solid you can choose that the files are extracted as soon as they are opened!. Why open the file, extract it, save it and then archive it??? Knowing that saving it will only create a local file on your computer, nothing more.
From excel impossible. As soon as the file is opened in an application (whether it's SW or something else, depending on the files), the vault prohibits any action.
Only the functions of the add-in in SW are functional as explained by G.
If the need lies in modifying variables and applying them to a file, it is possible but you have to proceed like this:
Extract the file
Update the desired variables
Open the file in SW
Save it (rebuild it if necessary)
Close File
Archive the file with a comment
All this is done from excel.
Otherwise, by playing with excel and the SW task scheduler, it can be played without the constraint of opening SW via excel.
The goal is to manipulate an excel file, not a SW file.
The goal is to modify an excel file, which retrieves variables from files that are pasted to it as a reference, then save this file (to do this, you have to extract it), then archive it. All this automatically with macros in the said Excel file.
So I need to extract an Excel file when it is open (I succeeded), but I would like to archive this same file.
I think it's possible because there is a pdm add-on for excel to do it.
Add-ons are not accessible via vba but via full-fledged programs. So from my point of view you have to do what I described but by replacing the SW file with an excel file and therefore manage in two files.
The first one extracts the excel file and opens it, triggers the macro of this file then closes and archives.
Cyril.f, I had thought of this solution. I want to avoid it. If it's feasible with an add-on, it should be doable via VBA (without necessarily launching the add-on) but by reproducing the function.