|
-
May 6th, 2014, 08:39 AM
#1
Thread Starter
Hyperactive Member
How to write a macro using VB.NET
Hello all
I have a word file and I want to restrict a copy paste in it, so I need to write a macro for that word file, I know how to write it but i want to do it programmatically using vb.net
How can i do that ? Macro should run for that specific file
Here is my macro
Code:
Sub EditCopy()
MsgBox “Forbidden”, vbExclamation
End Sub
Sub EditPaste()
MsgBox “Forbidden”, vbExclamation
End Sub
Please help
Thanks in advance
MCP, MCTS, Microsoft MVP [Asp.Net/IIS]
For more .NET development tips visit .NET Tips
If the post is useful then please  Rate it
-
May 6th, 2014, 11:46 AM
#2
Addicted Member
Re: How to write a macro using VB.NET
-
May 6th, 2014, 03:26 PM
#3
Re: How to write a macro using VB.NET
Is programming even really needed to do this? Couldnt you just Protect the document?
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 
-
May 6th, 2014, 11:26 PM
#4
Thread Starter
Hyperactive Member
Re: How to write a macro using VB.NET
 Originally Posted by RobDog888
Is programming even really needed to do this? Couldnt you just Protect the document?
Thanks for reply RobDog
What I exactly want is, avoid copy paste content and printing from my word document, I have tried with word protection with 'readonly' locking but, still I can able to copy and paste my word file content.
So I go for word macro.
How can I write macro using VB.NET for a given word file ?
Basically I need to develop program in vb.net where user can browse his word file and I can disable its copy paste facility by using macro.
Last edited by koolprasad2003; May 6th, 2014 at 11:30 PM.
MCP, MCTS, Microsoft MVP [Asp.Net/IIS]
For more .NET development tips visit .NET Tips
If the post is useful then please  Rate it
-
May 7th, 2014, 05:01 PM
#5
Re: How to write a macro using VB.NET
IMHO, You cannot do it via VB.Net unless you write a VSTO Add-in for the word document.
By any chance did you mean VBA and not VB.Net?
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
-
May 8th, 2014, 12:57 PM
#6
Re: How to write a macro using VB.NET
You cannot truely protect it with code or word protection as anyone that can view it can take screen shots and print that etc. You could put a watermark on it to make your ownership known
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 
Tags for this Thread
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
|