ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   CAN files be accessed with a macro when closed (https://www.excelbanter.com/excel-programming/402096-can-files-accessed-macro-when-closed.html)

Berj

CAN files be accessed with a macro when closed
 
Dear Anybody.

During recording a Macro, I have copied and pasted from different files and
sheets. In doing this, I have clicked on the files and sheets needed.
When the recorded Macro is running, it is maximizing the files needed
(considering they are open). This shows a lot of switching between windows
which is not needed.
- Can the window switching be disabled when the files are being accessed? How?
- Can the files be accessed even when they are closed? How?
Is there a way of adding a single command at the beginning of the macro to
do any of the things mentioned above?


Thanks in Advance.


Per Jessen

CAN files be accessed with a macro when closed
 



During recording a Macro, I have copied and pasted from different files
and
sheets. In doing this, I have clicked on the files and sheets needed.
When the recorded Macro is running, it is maximizing the files needed
(considering they are open). This shows a lot of switching between windows
which is not needed.
- Can the window switching be disabled when the files are being accessed?
How?
- Can the files be accessed even when they are closed? How?
Is there a way of adding a single command at the beginning of the macro to
do any of the things mentioned above?


Thanks in Advance.

Hi

Put this at the start of your code to prevent screenupdating.

Application.screenupdating =False


Just remember to set

Application.screenupdating = True

at the end of the code.

Regards

Per



Berj

CAN files be accessed with a macro when closed
 


"Per Jessen" wrote:




During recording a Macro, I have copied and pasted from different files
and
sheets. In doing this, I have clicked on the files and sheets needed.
When the recorded Macro is running, it is maximizing the files needed
(considering they are open). This shows a lot of switching between windows
which is not needed.
- Can the window switching be disabled when the files are being accessed?
How?
- Can the files be accessed even when they are closed? How?
Is there a way of adding a single command at the beginning of the macro to
do any of the things mentioned above?


Thanks in Advance.

Hi

Put this at the start of your code to prevent screenupdating.

Application.screenupdating =False


Just remember to set

Application.screenupdating = True

at the end of the code.

Regards

Per


This helped a lot. Thank you.

But I still have a problem.
The files have to be open so that the Macro works.
Is there a command again which I can add at the beginning of the macro so
that the data in the files can be accessed even if they are closed?



All times are GMT +1. The time now is 11:53 AM.

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