Log In

Your email is not your username

Register

If you were a member of the old Bodybuilding.com forums and would like to reuse your previous username, you can request it below. We use your email only for registration and do not store it. For more information, please see our Privacy Policy.

Confirm your email

A registration code was sent to your email. Enter it here.

Welcome

You have successfully setup your account.

Sign in

Quick Navigation Bottom Misc
Forum
» Microsoft Office experts - need help with a macro or other script
  1. Results 1 to 6 of 6
post 1652299973 12-10-2021, 10:02 AM
-
#1
  1. jreacher
  2. Registered User
  1. jreacher
  2. Registered User
  3. Join Date: Sep 2012
  4. Posts: 8,704
  5. Rep Power: 363348

Microsoft Office experts - need help with a macro or other script

So I have the windows clipboard turned off but Microsoft Office still collects clipboard activity.

Using Windows 10 Enterprise, Microsoft Office Professional Plus 2019, 64-bit

I need help creating a macro or a Windows script that can either automatically clear the clipboard every time I open Excel and/or word, or disable the clipboard completely.

Recording a macro won't do anything. I've been looking at stackoverflow and all kinds of sites and everything is chit.

Will rep hard for help.
post 1652300183 12-10-2021, 10:07 AM
-
#2
  1. mesobuild
  2. Premium User
  1. mesobuild
  2. Premium User
  3. Join Date: May 2020
  4. Posts: 17,953
  5. Rep Power: 44402
What clipboard information do you need to clear if you turned it off?
post 1652300423 12-10-2021, 10:10 AM
-
#3
  1. jreacher
  2. Registered User
  1. jreacher
  2. Registered User
  3. Join Date: Sep 2012
  4. Posts: 8,704
  5. Rep Power: 363348
Originally Posted By mesobuild
What clipboard information do you need to clear if you turned it off?
I'm using a password manager on my work computer and sometimes I have to copy from Bitwarden because the autofill doesn't work on every site. My computer is sometimes shared with others so I don't want stuff lurking in the clipboard on office
post 1652301963 12-10-2021, 10:38 AM
-
#4
  1. mesobuild
  2. Premium User
  1. mesobuild
  2. Premium User
  3. Join Date: May 2020
  4. Posts: 17,953
  5. Rep Power: 44402
Originally Posted By bov188
Just tested this and it worked

Code:Public Declare Function OpenClipboard Lib "user32" _
(ByVal hwnd As Long) As Long
Public Declare Function CloseClipboard Lib "user32" () As Long
Public Declare Function EmptyClipboard Lib "user32" () As Long

Sub ClearClipboard()
OpenClipboard (0&)
EmptyClipboard
CloseClipboard
End SubIf you're on a 64 bit system

Code:Declare PtrSafe Function OpenClipboard Lib "User32" (ByVal hwnd As LongPtr) As LongPtr
Declare PtrSafe Function CloseClipboard Lib "User32" () As Long
Declare PtrSafe Function EmptyClipboard Lib "User32" () As Long

Sub ClearClipboard()
OpenClipboard (0&)
EmptyClipboard
CloseClipboard
End Sub

Sub test()
Call ClearClipboard
End Subhttps://www.atlaspm.com/toms-tutoria...the-clipboard/
Nice. You do not need to type "Call" to execute a function. I'm rusty on other syntax. Looks good I think
post 1652302643 12-10-2021, 10:48 AM
-
#5
  1. jreacher
  2. Registered User
  1. jreacher
  2. Registered User
  3. Join Date: Sep 2012
  4. Posts: 8,704
  5. Rep Power: 363348
Originally Posted By bov188
Just tested this and it worked

Code:Public Declare Function OpenClipboard Lib "user32" _
(ByVal hwnd As Long) As Long
Public Declare Function CloseClipboard Lib "user32" () As Long
Public Declare Function EmptyClipboard Lib "user32" () As Long

Sub ClearClipboard()
OpenClipboard (0&)
EmptyClipboard
CloseClipboard
End SubIf you're on a 64 bit system

Code:Declare PtrSafe Function OpenClipboard Lib "User32" (ByVal hwnd As LongPtr) As LongPtr
Declare PtrSafe Function CloseClipboard Lib "User32" () As Long
Declare PtrSafe Function EmptyClipboard Lib "User32" () As Long

Sub ClearClipboard()
OpenClipboard (0&)
EmptyClipboard
CloseClipboard
End Sub

Sub test()
Call ClearClipboard
End Subhttps://www.atlaspm.com/toms-tutoria...the-clipboard/

If you just want to clear the MS Office clipboard just do

Code:Application.CutCopyMode = False
Thanks. I will try these.

Application.CutCopyMode = False didn't work when I tried it before. Maybe I am formatting my macro wrong?
post 1652336793 12-10-2021, 10:56 PM
-
#6
  1. Samraiwise
  2. 🥋 A Karate Kid age 65 🔥
  1. Samraiwise
  2. 🥋 A Karate Kid age 65 🔥
  3. Join Date: Mar 2007
  4. Location: Japan
  5. Posts: 24,376
  6. Rep Power: 1308174
Originally Posted By bov188
Just tested this and it worked

Code:Public Declare Function OpenClipboard Lib "user32" _
(ByVal hwnd As Long) As Long
Public Declare Function CloseClipboard Lib "user32" () As Long
Public Declare Function EmptyClipboard Lib "user32" () As Long

Sub ClearClipboard()
OpenClipboard (0&)
EmptyClipboard
CloseClipboard
End SubIf you're on a 64 bit system

Code:Declare PtrSafe Function OpenClipboard Lib "User32" (ByVal hwnd As LongPtr) As LongPtr
Declare PtrSafe Function CloseClipboard Lib "User32" () As Long
Declare PtrSafe Function EmptyClipboard Lib "User32" () As Long

Sub ClearClipboard()
OpenClipboard (0&)
EmptyClipboard
CloseClipboard
End Sub

Sub test()
Call ClearClipboard
End Subhttps://www.atlaspm.com/toms-tutoria...the-clipboard/

If you just want to clear the MS Office clipboard just do

Code:Application.CutCopyMode = False
A good job by a good man!!
Originally Posted By jreacher
Thanks. I will try these.

Application.CutCopyMode = False didn't work when I tried it before. Maybe I am formatting my macro wrong?
A nice thread my friend!
🌺 Lauren Brooks Kelly (snailsrus) - Jul 25, 1991 – Jan 29, 2022
Thread: RIP Snails : https://forum.obnoxiousbrutes.com/showthread.php?t=181070293&page=100

⭐ Samurai Break: 140kg(308lb) Failed Bench Press Recovery Video:
http://www.youtube.com/watch?v=U8eIkpZ29u0
⭐ Over 35 Journals > Samurai, Without Ever Having Felt Sorry For Itself:
https://forum.obnoxiousbrutes.com/showthread.php?t=4832373&page=200
📌 Please Call me Kaz, a 65-year-old 🥋 Karate Kid in Tokyo.
Quick Navigation Top Misc
Bookmarks
Digg.com
Digg
del.icio.us
del.icio.us
Stumbleupon.com
StumbleUpon
Google.com
Google
Facebook.com
Facebook
Posting Permissions
  1. You may not post new threads
  2. You may not post replies
  3. You may not post attachments
  4. You may not edit your posts