Forum
»
Microsoft Office experts - need help with a macro or other script
- Results 1 to 6 of 6
-
Page 1 of 1
12-10-2021, 10:02 AM
-
#1
- jreacher
- Registered User
-
- jreacher
- Registered User
- Join Date: Sep 2012
- Posts: 8,704
- 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.
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.
12-10-2021, 10:07 AM
-
#2
12-10-2021, 10:10 AM
-
#3
- jreacher
- Registered User
-
- jreacher
- Registered User
- Join Date: Sep 2012
- Posts: 8,704
- Rep Power: 363348
-
-
Originally Posted By mesobuild⏩
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 officeWhat clipboard information do you need to clear if you turned it off?
12-10-2021, 10:38 AM
-
#4
Originally Posted By bov188⏩
Nice. You do not need to type "Call" to execute a function. I'm rusty on other syntax. Looks good I thinkJust 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/
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/
12-10-2021, 10:48 AM
-
#5
- jreacher
- Registered User
-
- jreacher
- Registered User
- Join Date: Sep 2012
- Posts: 8,704
- Rep Power: 363348
-
-
Originally Posted By bov188⏩
Thanks. I will try these.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
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
Application.CutCopyMode = False didn't work when I tried it before. Maybe I am formatting my macro wrong?
12-10-2021, 10:56 PM
-
#6
- Samraiwise
- 🥋 A Karate Kid age 65 🔥
-
- Samraiwise
- 🥋 A Karate Kid age 65 🔥
- Join Date: Mar 2007
- Location: Japan
- Posts: 24,376
- Rep Power: 1308174
-
-
Originally Posted By bov188⏩
A good job by a good man!!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
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

Originally Posted By jreacher⏩
A nice thread my friend!Thanks. I will try these.
Application.CutCopyMode = False didn't work when I tried it before. Maybe I am formatting my macro wrong?
Application.CutCopyMode = False didn't work when I tried it before. Maybe I am formatting my macro wrong?

🌺 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.
Bookmarks
-
- Digg
-
- del.icio.us
-

- StumbleUpon
-
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts