ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Stopping Excel after running visual basic in Access (https://www.excelbanter.com/excel-programming/293738-stopping-excel-after-running-visual-basic-access.html)

Bill McCaleb

Stopping Excel after running visual basic in Access
 
After running the following sub the excel spreadsheet comes up. When
exiting out of excel the program appears to close but doesn't, it's
still running in the background. What's the problem?

Sub xls2()
Dim ex As New Excel.Application
Dim wrkbk As Excel.Workbook
Dim wks As Excel.Worksheet
Dim rng As Excel.Range

Set wrkbk = Workbooks.Open("c:\TRPWKBookA.xls")
Set wks = wrkbk.Worksheets("41 ECS")
wks.Range("b13").Value = 12
Set wks = wrkbk.Worksheets("755")
wks.Range("b13").Value = 13



'Set rng = wks.Cells(2, 13)
' With rng
' .Value =
'Set rng = wks.UsedRange.columns

ex.Visible = True



End Sub

Thanks if anyone can tell me what's wrong.
bill


Nigel[_8_]

Stopping Excel after running visual basic in Access
 
It appears you are not closing Excel

Try putting in the line

Set ex = Nothing


Cheers
Nigel

"Bill McCaleb" wrote in message
...
After running the following sub the excel spreadsheet comes up. When
exiting out of excel the program appears to close but doesn't, it's
still running in the background. What's the problem?

Sub xls2()
Dim ex As New Excel.Application
Dim wrkbk As Excel.Workbook
Dim wks As Excel.Worksheet
Dim rng As Excel.Range

Set wrkbk = Workbooks.Open("c:\TRPWKBookA.xls")
Set wks = wrkbk.Worksheets("41 ECS")
wks.Range("b13").Value = 12
Set wks = wrkbk.Worksheets("755")
wks.Range("b13").Value = 13



'Set rng = wks.Cells(2, 13)
' With rng
' .Value =
'Set rng = wks.UsedRange.columns

ex.Visible = True



End Sub

Thanks if anyone can tell me what's wrong.
bill





----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---

Tom Ogilvy

Stopping Excel after running visual basic in Access
 
Sub xls2()
Dim ex As New Excel.Application
Dim wrkbk As Excel.Workbook
Dim wks As Excel.Worksheet
Dim rng As Excel.Range

Set wrkbk = Workbooks.Open("c:\TRPWKBookA.xls")
Set wks = wrkbk.Worksheets("41 ECS")
wks.Range("b13").Value = 12
Set wks = wrkbk.Worksheets("755")
wks.Range("b13").Value = 13



'Set rng = wks.Cells(2, 13)
' With rng
' .Value =
'Set rng = wks.UsedRange.columns

ex.Visible = True
ex.Quit
set rng = Nothing
set wksh = Nothing
set wrkbk = nothing
set ex = nothing

End Sub

The code you show is fully qualified, but there is a possibility that this
isn't the actual code. fully qualify all references.

--
Regards,
Tom Ogilvy


"Bill McCaleb" wrote in message
...
After running the following sub the excel spreadsheet comes up. When
exiting out of excel the program appears to close but doesn't, it's
still running in the background. What's the problem?

Sub xls2()
Dim ex As New Excel.Application
Dim wrkbk As Excel.Workbook
Dim wks As Excel.Worksheet
Dim rng As Excel.Range

Set wrkbk = Workbooks.Open("c:\TRPWKBookA.xls")
Set wks = wrkbk.Worksheets("41 ECS")
wks.Range("b13").Value = 12
Set wks = wrkbk.Worksheets("755")
wks.Range("b13").Value = 13



'Set rng = wks.Cells(2, 13)
' With rng
' .Value =
'Set rng = wks.UsedRange.columns

ex.Visible = True



End Sub

Thanks if anyone can tell me what's wrong.
bill




Bill McCaleb

Stopping Excel after running visual basic in Access
 
I tried this but it still didn't work. I have to shut down excel with
the task manager. Anyone have any other solutions?
bill

Nigel wrote:

It appears you are not closing Excel

Try putting in the line

Set ex = Nothing


Cheers
Nigel

"Bill McCaleb" wrote in message
...

After running the following sub the excel spreadsheet comes up. When
exiting out of excel the program appears to close but doesn't, it's
still running in the background. What's the problem?

Sub xls2()
Dim ex As New Excel.Application
Dim wrkbk As Excel.Workbook
Dim wks As Excel.Worksheet
Dim rng As Excel.Range

Set wrkbk = Workbooks.Open("c:\TRPWKBookA.xls")
Set wks = wrkbk.Worksheets("41 ECS")
wks.Range("b13").Value = 12
Set wks = wrkbk.Worksheets("755")
wks.Range("b13").Value = 13



'Set rng = wks.Cells(2, 13)
' With rng
' .Value =
'Set rng = wks.UsedRange.columns

ex.Visible = True



End Sub

Thanks if anyone can tell me what's wrong.
bill






----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---



Tom Ogilvy

Stopping Excel after running visual basic in Access
 
Guess not if you are going to ignore them.

--
Regards,
Tom Ogilvy


"Bill McCaleb" wrote in message
...
I tried this but it still didn't work. I have to shut down excel with
the task manager. Anyone have any other solutions?
bill

Nigel wrote:

It appears you are not closing Excel

Try putting in the line

Set ex = Nothing


Cheers
Nigel

"Bill McCaleb" wrote in message
...

After running the following sub the excel spreadsheet comes up. When
exiting out of excel the program appears to close but doesn't, it's
still running in the background. What's the problem?

Sub xls2()
Dim ex As New Excel.Application
Dim wrkbk As Excel.Workbook
Dim wks As Excel.Worksheet
Dim rng As Excel.Range

Set wrkbk = Workbooks.Open("c:\TRPWKBookA.xls")
Set wks = wrkbk.Worksheets("41 ECS")
wks.Range("b13").Value = 12
Set wks = wrkbk.Worksheets("755")
wks.Range("b13").Value = 13



'Set rng = wks.Cells(2, 13)
' With rng
' .Value =
'Set rng = wks.UsedRange.columns

ex.Visible = True



End Sub

Thanks if anyone can tell me what's wrong.
bill






----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet

News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000

Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via

Encryption =---





All times are GMT +1. The time now is 08:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com