|
-
Oct 27th, 2005, 02:27 PM
#1
Thread Starter
Addicted Member
Clearing Clipboard in Excel
In VBA I am copying large amounts of info from one workbook to another. When I go to close the workbook it prompts me if I want to retain the clipboard info. How do I get rid of this message or clear the clipboard. Im not sure what forum to put this in, Im sorry.
-
Oct 27th, 2005, 02:34 PM
#2
Frenzied Member
Re: Clearing Clipboard in Excel
If you are talking about VB6 then
else tell mods to move it
-
Oct 27th, 2005, 02:47 PM
#3
Re: Clearing Clipboard in Excel
that wont work in VBA there is no "Clipboard" object
set the CutCopyMode = False
Application.CutCopyMode = False
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Oct 27th, 2005, 03:01 PM
#4
Re: Clearing Clipboard in Excel
CutCopyMode only cancels or returns the mode that the active cell is in. It can either remove the copy focus rectangle or return the state that the copy/cut is in. It doesnt clear the clipboard.
Moved from Classic VB forum.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 27th, 2005, 03:21 PM
#5
Re: Clearing Clipboard in Excel
You could just clear the clipboard from outside of Excel if all else fails.
Are you saving the workbook before you close it?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 27th, 2005, 03:49 PM
#6
Re: Clearing Clipboard in Excel
Ok, I played (tested) around a bit and came up with this in case you are saving your changes before closing the workbook.
VB Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Application.CutCopyMode = False
End Sub
I should have tested before posting. The definition didnt say anything about clearing the clipboard.
's Geoff
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 28th, 2005, 08:08 AM
#7
Thread Starter
Addicted Member
Re: Clearing Clipboard in Excel
No, I am not saving the workbooks. I'm not sure what you mean by clearing the clipboard outside of excel. Excel is the only application I am working in. I've tested the copyclip mode also and that only acts the way RobDog888 explained it. Looks like I'll just have to sit there and hit "No" everytime the dialoge box appears.
-
Oct 28th, 2005, 08:37 AM
#8
Re: Clearing Clipboard in Excel
Hmm, try adding the code to the BeforeClose event.
VB Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CutCopyMode = False
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 28th, 2005, 08:48 AM
#9
Member
Re: Clearing Clipboard in Excel
Would turning off warning not do it? or would that keep the data on the clipboard?
-
Oct 28th, 2005, 08:50 AM
#10
Re: Clearing Clipboard in Excel
I tried turning off the alerts earlier but it didnt affect the clipboard notice.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Nov 1st, 2005, 08:59 AM
#11
New Member
Re: Clearing Clipboard in Excel
Have you tried the : 'Application.DisplayAlerts = False' command ? Or is that what you are referring to in your last comment ?
You could also try the : 'On Error Resume Next' command before the problem but you must ensure that you follow this up with the 'On Error Goto 0' command directly after the line that's causing the problem, to ensure that you don't ignore further errors.
-
Nov 1st, 2005, 09:23 AM
#12
Thread Starter
Addicted Member
Re: Clearing Clipboard in Excel
Application.DisplayAllerts does not work. Neither does the OnError because it is not a triggered error.
-
Nov 1st, 2005, 10:05 AM
#13
Re: Clearing Clipboard in Excel
Didnt you try the code in my previous post (#6)? It works.
VB Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CutCopyMode = False
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 20th, 2007, 04:22 AM
#14
New Member
Re: Clearing Clipboard in Excel
I was experiencing the same problem, copying from multiple workbooks into a master dump, having to hit 'no' each time the prompt appeared asking if i wanted to retain the clipboard info.
By simply inserting the 'Application.CutCopyMode = False' code immediately before closing each workbook, the prompt was eliminated
Thanks Static
-
Sep 20th, 2007, 04:35 PM
#15
Frenzied Member
Re: Clearing Clipboard in Excel
The best way to clear the clipboard of huge amount of data is to copy ONE empty cell and it will take care of itself.
Code:
Range(“A1”).copy
Application.CutCopyMode = False
Last edited by Liquid Metal; Sep 20th, 2007 at 04:38 PM.
I'll Be Back!
T-1000
Microsoft .Net 2005
Microsoft Visual Basic 6
Prefer using API
-
Sep 22nd, 2007, 09:44 AM
#16
Re: Clearing Clipboard in Excel
 Originally Posted by Esham
In VBA I am copying large amounts of info from one workbook to another. When I go to close the workbook it prompts me if I want to retain the clipboard info. How do I get rid of this message or clear the clipboard. Im not sure what forum to put this in, Im sorry.
A better suggestion... Use APIs
Check this out...
http://vbforums.com/showthread.php?t=449922
Hope this helps...
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|