Thread
:
Read data from workbook without showing it?
View Single Post
#
5
Posted to microsoft.public.excel.programming
Don Guillett
external usenet poster
Posts: 10,124
Read data from workbook without showing it?
Sub OpenAndDothings()
'Change this to your directory
APPLICATION.SCREENUPDATING=FALSE
MyPath = "C:\"
MyFile = "Book3.xls"
Workbooks.Open Filename:=MyPath & MyFile
'Do things
ActiveWorkbook.Close savechanges:=False
APPLICATION.SCREENUPDATING=TRUE
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Gustaf" wrote in message
...
Thank you for the reply. The 'savechanges' parameter will be useful.
However, I don't see the "without showing it" in your code. I'm currently
using the Open method like you do and I'm able to import the data I want.
But I'd rather not see the workbook at all (not as a window, and not on
the task bar). Is that possible to achieve?
Gustaf
--
Mike H wrote:
Hi,
This opens a workbook and if it's alraedy open that doesn't cause a
problem. You would need to be more specific if you need help with reading
data from selected sheets
Sub OpenAndDothings()
'Change this to your directory
MyPath = "C:\"
MyFile = "Book3.xls"
Workbooks.Open Filename:=MyPath & MyFile
'Do things
ActiveWorkbook.Close savechanges:=False
End Sub
Mike
"Gustaf" wrote:
How do you load a workbook from VBA, read data from selected sheets
and then close it, without it ever showing?
Also, is it necessary to check whether a workbook is already opened
before opening it, and closed before closing it?
Many thanks,
Gustaf
Reply With Quote
Don Guillett
View Public Profile
Find all posts by Don Guillett