Hello Guys,
This macro has issues, It works sometimes & sometimes it didn't workPlease Login or Register to view this content.
I am unable to find the problem of this macro
Plz Have a look Sir\Mam
Thnx
Hello Guys,
This macro has issues, It works sometimes & sometimes it didn't workPlease Login or Register to view this content.
I am unable to find the problem of this macro
Plz Have a look Sir\Mam
Thnx
Why not simple?
Shell "cmd /c start C:\Users\WolfieeeStyle\Desktop\WolfieeeStyle\9.15\Close Excel.lnk"", vbHide
I got this macro by doing google searches
I am looking for a macro that if file existthen first move the file toPlease Login or Register to view this content.
& run the close excel.lnk nothing else I need & if the file is not located then do nothingPlease Login or Register to view this content.
Please Login or Register to view this content.
I putted this Shell "cmd /c start C:\Users\WolfieeeStyle\Desktop\WolfieeeStyle\9.15\Close Excel.lnk"", vbHide
& i run the macro but not getting any output
What output you expect? what is the Close Excel.lnk command?
output means
I am looking for a macro that if file existthen first move the file toPlease Login or Register to view this content.
& then run the close excel.lnk & if the file is not locatedPlease Login or Register to view this content.
then do nothingPlease Login or Register to view this content.
close excel is what (i putted this taskkill /F /IM EXCEL.EXE to notepad & save it as a .bat file & i created a shortcut link of that .bat file to desktop & named that file to close excel.lnk
Y i created a shorcut link is whenevr i run that close excel.bat then it doesn't work if i run that close excel.bat by administrator then it works , so i created a shortcut link of closeexcel.bat which is close excel.lnk & from settings i assigned that to always run by administrator , so whenevr it will be run then it will run as admin & everything will be perfect
Last edited by quirkybox; 08-15-2020 at 12:42 PM.
You can start taskkill directly from shell without lnk.
If u mean to say that opening task manager & kill all the excel file then yes i can do that but i am not looking for manual work bcoz i have to do this 4 times a day & 365 days of a year then this will not be a great Idea Sir
I am looking for macro (automation. no manual work from my end )
QB,
there are a few ways to run the CMD with this coding environment. this was written long ago by me and has worked fine ever since. maybe you can get something from it:
this is the website that is most helpful for running DOS commands, IMO:Please Login or Register to view this content.
https://www.computerhope.com/msdos.htm
Bro i saw this
Please Login or Register to view this content.
I dont know what to do with this & i never used such type of macros nor i have any idea of such type of macros & u know the condition also of the macro so plz help me for the same, i am not a professional vba coder sir so plz help
& one more thing u have used xcopy & there is no copy paste in this problem Sir
Last edited by quirkybox; 08-15-2020 at 02:05 PM.
you don't know how to do what exactly? you have to be specific. that's the biggest quirk of professionals. ha ha. SPECIFICS! so....here are some questions to ask:
=> what is a public function?
=> where do I put this code in my workbook?
=> what does that code do?
=> what do the comments mean? what is "strArg"?
see where I'm going with this? I've heard people say "I don't how to use that" for 20 years, and that doesn't help an experienced person help *you*. Can you clarify?
I puted this macro to macro.xlsm & I dont know anything about public function,strArg I got this macro from google searchPlease Login or Register to view this content.
I know what macro should do
The condition are below what i have to do & what macro should do
First it should check wheather close excel.lnk is located here or not C:\Users\WolfieeeStyle\Desktop
If not located then do nothing
& if Close Excel.lnk is located at C:\Users\WolfieeeStyle\Desktop then first move the close excel.lnk to C:\Users\WolfieeeStyle\Desktop\WolfieeeStyle\9.15\
& then run the close excel.lnk
If my macro is not proper then plz change it
Please Login or Register to view this content.
some others here have tried to help, so I'm maybe I'm stepping on their toes. but maybe we're close. here's what I see. this....
...is fine if the shortcut IS actually at that address. this....Please Login or Register to view this content.
....should work fine. dir returns what you are checking. this....Please Login or Register to view this content.
....should also work fine, per this: https://docs.microsoft.com/en-us/off...ovefile-methodPlease Login or Register to view this content.
this....
.....is a wildcard.Please Login or Register to view this content.
so, set some breakpoints in the code and tell us exactly which line of code is offending (not working). can you do that?
I used this & this is working perfectPlease Login or Register to view this content.
Awesome Bro
What a Idea
Awesome Solution Sir
Have a Great Day,Awesome Day Sir
Problem Solved
Last edited by quirkybox; 08-15-2020 at 02:39 PM.
I replicated your issue with the same directories, and this works just fine for me:
this also works just fine for me (this is MOVING the file, not COPYING it):Please Login or Register to view this content.
so obviously the FSO object works fine. I think what you were missing, is that you were running this line:Please Login or Register to view this content.
when you move a file either with the file scripting object in VBA or with the CMD shell, you HAVE to include the file name and extension too! goofy. did this solve it now?Please Login or Register to view this content.
Sir i deleted that close file.lnk & close file.bat file
bcoz the below macro close the excel, so now i dont need that .bat file & .lnk file
this macro is perfect for mePlease Login or Register to view this content.
Yes No Doubt Problem Solved Sir
@quirkybox Thanks for rep. Some times we must ask how to get aim but not how to correct wrong and difficult way :-)
If you would like to close application without any question then you can use
Please Login or Register to view this content.
Ithink no need to use this
bcoz when we are using the below macro then In any condition excel will close itself without any question or pop upPlease Login or Register to view this content.
Sub STEP2()Please Login or Register to view this content.
shell "taskkill /F /IM EXCEL.EXE"
End SubPlease Login or Register to view this content.
good! good luck to you! oh, and don't call me sir. I'm only 40 years old.
Ok No Problem Bro
Thnx
@quirkybox. Think about compatibility.
The last code will work on the MacOS also. The taskkill available only for Windows system.
No Doubt, I will go with the windows only & i am satisfied with the macro that i have recv
Thnx for providing the Great Info To me Sir
I made this macro SirPlease Login or Register to view this content.
Reason i made this macro is bcoz the logic which i used was not correct
I sent u this macro only to see is this macro correct, is there any error in the macro then plz let me know
Just see this macro has any errors or Any modifcation is needed as per u ?
This macro does the same what i want to do
only i have shared the macro to let u know that plz check the macro & plz let me know is it perfect or not
Last edited by quirkybox; 08-16-2020 at 04:43 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks