Solved

VB for Excel to suspend window updating while updating another workbook

Posted on 2011-03-07
8
548 Views
Last Modified: 2012-05-11
Hello Experts.

I have an Excel workbook that opens a second workbook copies range(s) of info from the 1st workbook finds the last line of input on the 2nd workbook and pastes the values of the info to that 2nd workbook.

It is annoying to see the program open the 2nd workbook and then copy the info to it and save and close that 2nd workbook.

Is there a way in VB to open the second WB in minimized state and do the copy, paste, save and close of that 2nd WB without it flashing on the screen?

I have tried both:
    Application.ScreenUpdating = False
    Application.WindowState = Excel.XlWindowState.xlMinimized

both ways eventually flash the file on the screen.

0
Comment
Question by:wlwebb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 18

Expert Comment

by:Jerry Miller
ID: 35064095
Application.visible = false will do the trick
0
 
LVL 10

Accepted Solution

by:
Makrini earned 500 total points
ID: 35064153
Application.screenupdating = false
  <then all of your code>
Application.screenupdating = true
0
 

Author Comment

by:wlwebb
ID: 35064253
Well that certainly works.  However I fear that it will freak out the clerk when the whole program disappears 6mos from now when there is lots of data and it takes a minute or so to find the bottom of the data to paste the new data to.

Is there any other way that leaves the first wb on an open screen like it is a "frozen" image with a Msgbox saying "updating info please wait"
0
Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

 

Author Comment

by:wlwebb
ID: 35064259
Makrini, I tried that, it doesn't work.
0
 

Author Comment

by:wlwebb
ID: 35064334
Makrini,  it worked.... as you suspected....

I put the true at the top and the false at the bottom....   DUHHHHHHHHH

How can I get a Msgbox that has a progress bar going while I have that screen updating = false state
0
 
LVL 10

Expert Comment

by:Makrini
ID: 35064456
Without turning screenupdating on again every now and then, its not really possible...

If your Macro is doing a lot of "select" and "Activate" statements your Macro is probably taking a lot longer than it should anyway.  Much better to optimise and make it run as fast as possible, then warn the user it could take a minute.

(If you are only pasting one section of data below the rest, we can find the last row in less than a second)
0
 

Author Closing Comment

by:wlwebb
ID: 35064533
Thanks,  I read some other "solutions" in the interim and saw that most all experts discouraged a progress bar.

Thank you for the help.
0
 
LVL 10

Expert Comment

by:Makrini
ID: 35064633
No prob.  Have fun with it.  The better you get, the faster your macros become and the less problem it is
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question