ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to disable MS Excel Clipboard message when I run a macro (https://www.excelbanter.com/excel-programming/348181-how-disable-ms-excel-clipboard-message-when-i-run-macro.html)

Bon

How to disable MS Excel Clipboard message when I run a macro
 
Hello all

I want to disable the Microsoft Excel clipboard message. How can I do
it?

I create a macro in MS Word 2000. The macro is used to copy a
worksheet content (include graphic, chart and text) to Word. The macro
is working fine. But, the MS Excel message always popped up everytime I
run the macro.

The MS Excel message is as below:

"There is a large amount of information on the Clipboard. Do you want
to be able to paste this information into another program later?
- To save it on the Clipboard so that you can paste it later, click
Yes.
- To delete it from the Clipboard and free memory, click No."

My Word macro is as follow:

Sub CopyExcelToWord()

Dim xlApp As Excel.Application
Dim xlWorkbook As Excel.Workbook
Dim xlWorksheet As Excel.Worksheet
Dim xlRange As Excel.Range
Dim ExcelWasNotRunning As Boolean
Dim WorkbookToWorkOn As String

WorkbookToWorkOn = "c:\test\Book2.xls"

On Error Resume Next
Set xlApp = GetObject(, "Excel.Application")

If Err Then
ExcelWasNotRunning = True
Set xlApplication = New Excel.Application
End If
xlApp.Visible = False

Set xlWorkbook = xlApp.Workbooks.Open(FileName:=WorkbookToWorkOn)
Set xlWorksheet = xlWorkbook.Worksheets("Sheet1")
xlWorksheet.Range("A1:R59").Copy

ActiveDocument.Bookmarks("PersonalData").Range.Pas teSpecial _
link:=False, _
DataType:=wdPasteMetafilePicture

If ExcelWasNotRunning Then
xlApp.Quit
End If

xlWorkbook.Close
Set xlRange = Nothing
Set xlWorksheet = Nothing
Set xlWorkbook = Nothing
Set xlApp = Nothing
End Sub

Please give me some suggestions

Thanks
Bon


Bon

How to disable MS Excel Clipboard message when I run a macro
 
The problem is solved. Thanks



All times are GMT +1. The time now is 09:52 PM.

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