Isaac
Lifelong Learner
- Local time
- Today, 03:12
- Joined
- Mar 14, 2017
- Messages
- 10,109
xl.Quit is right, but your code has so many errors you will never even get to that point, which is why people are trying to help you with those errors too.
"With Xl" makes no sense, because .columns is not a property or method of the excel application! it should be with ws
to start with.
Also, in case the user has opened another workbook in that same excel instance, you may wish to do something like this:
"With Xl" makes no sense, because .columns is not a property or method of the excel application! it should be with ws
to start with.
Also, in case the user has opened another workbook in that same excel instance, you may wish to do something like this:
Code:
if xl.workbooks.count=0 then
xl.quit 'quit whole app
else
wb.close true 'only close the wb you opened
end if