It should be
Dim RetVariables() as Variant
Your folder ID will come from objFolder. (objFolder.ID)
Thank you for your quick response! With your comments I was able to solve my problem, the script is working correctly now.
The only issue which I have now; using FileName = Application.GetOpenFilename("All Files (*.*),*.*") only works when I have a file saved local. When a file is not saved local I recieve the error: "File not found", when selecting it. Using 'Get latest version' solves the problem, but is not the most convenient way. Is there any other way to solve this?
Maybe I should open a new thread for this question?