Advertisement

08.27.2007 at 03:29PM PDT, ID: 22790303
[x]
Attachment Details

Copy to clipboard message bypass in VBA code

Asked by piyushdabomb in Microsoft Excel Spreadsheet Software, VB Database Programming, VB Objects

Tags: clipboard, vba, excel, copy, message

Team,

I have currently built a report for senior management by which information from Excels workbook is copied to MS Office using VBA. The whole report works except for this ridiculous milestone which I can not get rid of. I am constantly given a message box which states "There is a large amount of information on the clipboard. Do you want to be able to paste this information into another program later?" The options I have been given are "Yes", "No", and "Cancel".

Is there a way I can turn this off using VBA? The code snippet I am using currently in my MS Word File is:
---------------------------------------------------------
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set xlWB = xlApp.Workbooks.Open(Executive_Report_WB)
Application.DisplayAlerts = False
xlWB.sheets("Executive Summary").Select
xlWB.Activesheet.Range("D7:Q39").Copy
Selection.PasteSpecial
    xlWB.Close False ' close the workbook without saving
    xlApp.Quit ' close the Excel application
    Set xlWB = Nothing
    Set xlApp = Nothing
Application.DisplayAlerts = True
---------------------------------------------------------
**** PLEASE NOTE: The code works perfectly if I say "Yes" or "No" to the clipboard dialog box. I have tried using the the DisplayAlerts command as you can see in my code snippet but doesn't seem to work. Start Free Trial
[+][-]08.27.2007 at 04:15PM PDT, ID: 19779302

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, VB Database Programming, VB Objects
Tags: clipboard, vba, excel, copy, message
Sign Up Now!
Solution Provided By: byundt
Participating Experts: 1
Solution Grade: A
 
 
[+][-]08.27.2007 at 04:26PM PDT, ID: 19779352

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.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628