Link to home
Start Free TrialLog in
Avatar of Cedric D
Cedric DFlag for United States of America

asked on

Cannot Run Macro from script

Hello,
I am trying to run the script (see attached file), however after I press "ALT+F11" in Outlook then copy/paste and run my script I'm getting an error "Compile error: invalid outside procedure".
Please tell me what am I doing wrong, sorry I'm very new to run macros via Visual Basic Editor.

Export-Folder-Structure-VBS.txt
Avatar of Fabrice Lambert
Fabrice Lambert
Flag of France image

Randomize

Q_26908386

Open in new window

These 2 functions (or procedures) call are in the global scope, and as the error say, you can only call functions (or procedures) within functions (or procedures)

Side notes:
Global scope is evil, try to avoid it.
Avatar of Cedric D

ASKER

Not sure how this script will work, would you please give me more details. I have removed these 2 functions and still getting the same issue.
ASKER CERTIFIED SOLUTION
Avatar of Alexei Kuznetsov
Alexei Kuznetsov
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This works.