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

B

Bon

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.PasteSpecial _
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top