How to empty the clipboard using vba code
Robin,
Use
Application.CutCopyMode = False
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
"Robin Ketting" wrote in message
...
Hello fellow developers,
I'm writing vba code for years now, in Excel as well in
other Office applications.
Now I stumble into a little problem I like to resolve.
I copy some rows in a previous function, open a new .xls
file, paste the rows in the new sheet, ans save the new
sheet.
However, when I close Excel, I get the question if I want
to keep the -into the clipboard copied data- for further
use.
And I don't want this question.. because the new file is
just a file I use lateron as a Word datafile.
Does anybody know a solution to use vba code to empty the
clipboard, or any other solution so I don't get the
popwindow anymore??
The code I have written so far is:
Function fncCreateNewSheet(strNewFilename As String) As
Boolean
On Error GoTo err_fncCreateNewSheet
Application.StatusBar = "Put copied rows into new sheet..."
Set xlApp2 = CreateObject("Excel.Application")
Set xlBook2 = xlApp2.Workbooks.Add
Set xlSheet2 = xlBook2.Worksheets(1)
xlApp2.Visible = True
xlSheet2.Cells(1, 1).Select
xlSheet2.Paste
Application.StatusBar = "Save Datafile as " &
strNewFilename
xlBook2.SaveAs strNewFilename, , , , True
'//Here I like to empty the clipboard??
''clipboard.Empty
xlBook2.Close
xlApp2.Quit
Set xlApp2 = Nothing
exit_fncCreateNewSheet:
Exit Sub
err_fncCreateNewSheet:
Call subErrorHandling(True, Err, Erl, Err.Description,
CurrentType, CurrentName, "fncCreateNewSheet")
Resume exit_fncCreateNewSheet
End Function
|