Advertisement

11.05.2007 at 06:25PM PST, ID: 22940837
[x]
Attachment Details

Open/Close Excel workbooks with VBA

Asked by bclivell in Microsoft Excel Spreadsheet Software, Miscellaneous Programming, Visual Basic Programming

Tags: vba, excel, close, workbook, open

Hi All-

I have a small vba script that opens and closes a workbook behind the scenes.  I need to let the workbook stay open for a few seconds at most to allow for another workbook to update, then I want the source workbook to close.  

When the source workbook goes to close, it asks "This action will cancel a pending data refresh.  Continue?" and then it asks if I want to save the sourve file, which I do not.  How do I: 1) Allow the source workbook to stay open for a second or two?, 2) have vba script select "okay" when asked to continue?, and 3) select do not save when the source workbook closes.  Below is the basic code I have started with.  Thank you!!!

    Application.ScreenUpdating = False
   
    Dim strSourceWB As String
    strSourceWB = Worksheets("Project Plan Overview_Sampling").Range("b5").Value
     
    Workbooks.Open (strSourceWB)
   
    ActiveWorkbook.CloseStart Free Trial
[+][-]11.05.2007 at 06:37PM PST, ID: 20221095

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.05.2007 at 07:34PM PST, ID: 20221240

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.05.2007 at 08:37PM PST, ID: 20221410

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.05.2007 at 08:39PM PST, ID: 20221419

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Excel Spreadsheet Software, Miscellaneous Programming, Visual Basic Programming
Tags: vba, excel, close, workbook, open
Sign Up Now!
Solution Provided By: webtubbs
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628