Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
agni_gold
Specialist III
Specialist III

Macro returning to module after completion

Hi Friends,

I came to one situation ,

I have written macro to get owner of the files in directory , but when I run this macro from Button , then macro is running fine , but when it got completed it is again opens module. I am not understanding why it is happening .

Attaching my macro, please help

1 Solution

Accepted Solutions
tamilarasu
Champion
Champion

Hello,

For me it is working fine and it did not show macro window. I have tested the code in V.12.10.

This is not related to your question but thought of sharing with you. If user type the file name in small letters then your current code will not execute the below line. You need to use "Ucase" statement here to avoid such scenario.

  If UCase(objFSO.GetExtensionName(objFile.name)) = filetype Then

  If UCase(objFSO.GetExtensionName(objFile.name)) = UCASE(filetype) Then

View solution in original post

17 Replies
agni_gold
Specialist III
Specialist III
Author

gwassenaar‌ can you please help me here.

agni_gold
Specialist III
Specialist III
Author

Any one please help here!!

olivierrobin
Specialist III
Specialist III

hello

do you mean that macro editor window is opening after execution ?

it yes, it is beacause there's an error in your macro.

you have to check the code

agni_gold
Specialist III
Specialist III
Author

Yes macro editor window is opening after execution.

But my required output came.

Can you please check my macro attached in original discussion and guide me where I am doing wrong .

Thanks

olivierrobin
Specialist III
Specialist III

which macro do you call in your button ?

and how are executed  the 1st 5 lignes (they don't belong to a names macro ?)

did you check your variables names ?

olivierrobin
Specialist III
Specialist III

when I copy your code in macro editoer, and run Check, I have this error :

ActiveX component can't create object: 'Scripting.FileSystemObject'  on line 3

agni_gold
Specialist III
Specialist III
Author

processdocument macro running from the button.

And variables are correct.

agni_gold
Specialist III
Specialist III
Author

So how can I fix this problem, if this is the error.?

olivierrobin
Specialist III
Specialist III

I has a problem with admin rights . it's now ok

i have the same problem : process a long time and then reshow the dialog editor

you will have to trace the execution of the macro by adding msgbox instructions to see where the problem is

what i did :

sub processDocument
msgbox "Process will start , Please click OK."

If objFSO.FileExists(OUTPUT_FILE) Then
msgbox "exist"
'you delete if you find it'
msgbox "Trouvé"