ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Closing File (https://www.excelbanter.com/excel-programming/326966-vba-closing-file.html)

John Viall[_2_]

VBA Closing File
 
Two questions:
1. I have a VBA app, that opens two files, merges the important data into
one, then closes the file I don't need anymore. How can I get it to stop
prompting me to save it, and to not ask me about the large amount of data
left on the clipboard?

2. I know this isn't the right forum, but since I'm asking a question
already, here goes. I wrote a VBA app in word to open an Excel file, load
the data into an array, but it won't unload the excel file from memory. If I
look at the task manager, the file is still open. (in the process of
building this new app, I may have already figured this out, but haven't had
the time to try it.)

Thanks in advance.
John

Robin Hammond[_2_]

VBA Closing File
 
John,

1.
This will stop the closing prompt
ActiveWorkbook.Close false

this may stop the clipboard prompt. Not entirely sure though.
application.displayalerts = false

2.
You might need to show your code, but it should be something like
Sub Test()
Dim objExcel As Excel.Application
Set objExcel = CreateObject("Excel.application")
'do something with your excel object
Set objExcel = Nothing
End Sub

Robin Hammond
www.enhanceddatasystems.com

"John Viall" wrote in message
...
Two questions:
1. I have a VBA app, that opens two files, merges the important data into
one, then closes the file I don't need anymore. How can I get it to stop
prompting me to save it, and to not ask me about the large amount of data
left on the clipboard?

2. I know this isn't the right forum, but since I'm asking a question
already, here goes. I wrote a VBA app in word to open an Excel file, load
the data into an array, but it won't unload the excel file from memory.
If I
look at the task manager, the file is still open. (in the process of
building this new app, I may have already figured this out, but haven't
had
the time to try it.)

Thanks in advance.
John




Patrick Molloy[_2_]

VBA Closing File
 
1. set
Application.DisplayAlerts = FALSE
befor ethe code that closes the file

2. make sure that you have code like
( assuming XLApp is dim's as the Excel Application object)

XLApp.Quit
SET XLApp = Nothing

Exel DOES have a problem releasing memory until its quit. I wonder if Word
has a similar issue? Haven't searched the KB, but it wouldn't surprise me as
many Office components get shared amonst the Office applications.


"John Viall" wrote:

Two questions:
1. I have a VBA app, that opens two files, merges the important data into
one, then closes the file I don't need anymore. How can I get it to stop
prompting me to save it, and to not ask me about the large amount of data
left on the clipboard?

2. I know this isn't the right forum, but since I'm asking a question
already, here goes. I wrote a VBA app in word to open an Excel file, load
the data into an array, but it won't unload the excel file from memory. If I
look at the task manager, the file is still open. (in the process of
building this new app, I may have already figured this out, but haven't had
the time to try it.)

Thanks in advance.
John


John Viall[_2_]

VBA Closing File
 
Both worked, thanks.

"Patrick Molloy" wrote:

1. set
Application.DisplayAlerts = FALSE
befor ethe code that closes the file

2. make sure that you have code like
( assuming XLApp is dim's as the Excel Application object)

XLApp.Quit
SET XLApp = Nothing

Exel DOES have a problem releasing memory until its quit. I wonder if Word
has a similar issue? Haven't searched the KB, but it wouldn't surprise me as
many Office components get shared amonst the Office applications.


"John Viall" wrote:

Two questions:
1. I have a VBA app, that opens two files, merges the important data into
one, then closes the file I don't need anymore. How can I get it to stop
prompting me to save it, and to not ask me about the large amount of data
left on the clipboard?

2. I know this isn't the right forum, but since I'm asking a question
already, here goes. I wrote a VBA app in word to open an Excel file, load
the data into an array, but it won't unload the excel file from memory. If I
look at the task manager, the file is still open. (in the process of
building this new app, I may have already figured this out, but haven't had
the time to try it.)

Thanks in advance.
John



All times are GMT +1. The time now is 03:07 AM.

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