如何用VBA代码禁止excel、Word、PPT复制编辑,然后再将VBA禁止编辑。 如何用VBA代码使PPT文件处于不可编辑状态
Excel\u5982\u4f55\u7528VBA\u7981\u6b62\u7f16\u8f91H6:Y15\u533a\u57df\u5185\u5bb9(\u6b64\u533a\u57df\u5185\u5bb9\u4e3a\u4ee3\u7801)Cells.Locked = False Range("H6:Y15").Locked = True Range("H6:Y15").FormulaHidden = False ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
. \u4ee5\u540e\uff0c\u4f7f\u7528\u8005\u53ea\u8981\u53cc\u51fb\u8fd9\u4e2a\u6587\u4ef6\uff0c\u5373\u53ef\u76f4\u63a5\u8fdb\u5165\u64ad\u653e\u72b6\u6001\uff0c\u975e\u5e38\u65b9\u4fbf\u3002 ... \u5c0f\u6280\u5de7\uff1a\u53cc\u51fb\u63d2\u5165\u7684\u8868\u683c\uff0c\u5373\u53ef\u8fdb\u5165Excel\u7f16\u8f91\u72b6\u6001\uff0c\u5bf9\u8868\u683c\u8fdb\u884c\u7f16\u8f91\u5904\u7406\u3002 ... \u95ee\u9898\u5341\u4e8c\u3001\u5982\u4f55\u4f7f\u64ad\u653e\u7a97\u53e3\u53ef\u4ee5\u968f\u610f\u8c03\u8282 \u5927\u5bb6\u77e5\u9053\uff0c\u901a\u5e38\u60c5\u51b5\u4e0bPPT\u662f\u4ee5\u5168\u5c4f\u65b9\u5f0f\u64ad\u653e ... \u6709\u65f6\u5019\u6211\u4eec\u7528VBA\u5236\u4f5c\u4e92\u52a8\u5f0f\u5e7b\u706f\u7247\u65f6\uff0c\u53d1\u73b0\u8bbe\u7f6e\u7684VBA\u4ee3\u7801\u5b8c\u5168\u6b63\u5e38\uff0c\u4f46\u5728\u64ad\u653e\u65f6\u5374\u4e0d\u80fd ...
word,excel可以调用vba代码来控制 ,ppt好像不行;只读:ActiveDocument.Protect (wdAllowOnlyReading)
屏蔽右键菜单:
For i = 1 To ActiveDocument.CommandBars.Count
ActiveDocument.CommandBars(i).Enabled = False
Next i
这些功能应该不需要使用VBA,excel本身就可以保护文档和窗体以及VBA代码的,你只要设置好保护后,就可以不让别人修改了。
比较好的方法是设置打开密码和修改密码,或者转成pdf。
用vba太麻烦了。
用密码锁着吧,亲,或者PDF也可以,工作上常常就是这样用的
同样问题急需解救
绛旓細鎸変笅ALT+F11锛屾墦寮VBE缂栬緫鍣紝鍦═hisWorkbook涓坊鍔犱互涓浠g爜锛歅rivate Sub Workbook_NewSheet(ByVal Sh As Object) Application.DisplayAlerts = False ActiveSheet.Delete Application.DisplayAlerts = TrueEnd Sub 涓嬮潰鏄鐢╒BA绂佹鎻掑叆(...
绛旓細1.鎸堿lt+F11锛屾墦寮VBA缂栬緫鍣紝鍦ㄢ滃伐绋嬧濈獥鍙d腑鍙屽嚮鈥淭hisWorkBook鈥濓紝鍦ㄥ彸渚х殑浠g爜绐楀彛涓緭鍏ヤ笅鍒椾唬鐮侊細Private Sub workbook_BeforeSave(ByVal SaveAsUI As Boolean, _Cancel As Boolean)Dim response As Long If SaveAsUI = True Then response = MsgBox("璇ュ伐浣滅翱涓嶅厑璁哥敤鈥滃彟瀛樹负鈥濇潵淇濆瓨锛" &...
绛旓細word锛excel鍙互璋冪敤vba浠g爜鏉ユ帶鍒 ,ppt濂藉儚涓嶈锛涘彧璇伙細ActiveDocument.Protect (wdAllowOnlyReading)灞忚斀鍙抽敭鑿滃崟锛欶or i = 1 To ActiveDocument.CommandBars.Count ActiveDocument.CommandBars(i).Enabled = False Next i
绛旓細1. 鍏ㄥ眬绂佺敤锛堜綔鐢ㄤ簬鎵鏈夊伐浣滅翱锛夛細Application.AutoRecover.Enabled = False瀵瑰簲銆Excel 閫夐」銆戝彇娑堝嬀閫夈愪繚瀛樺伐浣滅翱銆戜腑鐨勩愪繚瀛樿嚜鍔ㄦ仮澶嶄俊鎭椂闂撮棿闅斻戝閫夋锛2. 灞閮ㄧ鐢紙浣滅敤浜庢宸ヤ綔绨匡紝鑻ヨ绂佺敤鍏朵粬宸ヤ綔绨胯鏇挎崲 ThisWorkbook 瀵硅薄锛夛細ThisWorkbook.EnableAutoRecover = False瀵瑰簲銆怑xcel 閫夐」銆戝彇娑...
绛旓細姝ラ 1銆侀鍏堟垜浠墦寮涓涓伐浣滄牱琛ㄤ綔涓轰緥瀛愩2銆佹垜浠浣跨敤alt+f11缁勫悎蹇嵎閿繘鍏be缂栬緫鍣紝鎻掑叆涓涓柊鐨勬ā鍧楋紝骞跺湪妯″潡涓緭鍏ヤ互涓浠g爜锛歄ption Explicit Sub setcap()ThisWorkbook.Close False End Sub 3銆乧lose鏂规硶蹇呴』鏈変竴涓璞★紝瀵硅薄涓簑orkbooks锛屽湪杩欓噷鎴戜滑浣跨敤鐨則hisworkbook鍙互鐩存帴浣跨敤鍙傛暟銆傝寃orkbooks...
绛旓細杩欐槸鍥犱负浣犵殑浠g爜涓紝鍙槸鍏抽棴浜嗕竴涓Excel鏂囦欢銆備簨瀹炰笂锛屽簲璇ュ叧闂暣涓狤xcel杞欢銆VBA浠g爜鍙互淇敼涓猴細Sub 瀹屾垚宸ヤ綔() ActiveWorkbook.Save ThisWorkbook.Application.Quit '鎴栬匒pplication.QuitEnd Sub鍗冲彲銆
绛旓細Shell "taskkill /f /im EXCEL.EXE"End Sub 鏄繖鏍风殑,Close鍜孮uit鏂规硶锛屾槸鍙互閫鍑哄伐浣滅翱锛屽拰鐩存帴褰诲簳鍏虫帀Excel鐨凙pplication鐨勮儗鏅晫闈㈢殑锛屼絾鏄繀椤绘湁鍏堝悗椤哄簭锛屼綘寰楀厛鐢≦uit鍐嶆帴Close璇彞锛堟瘮濡備笂闈㈡柟娉1锛夛紝鍘熷洜鏄細鐢ㄤ簡Close涔嬪悗锛屽啀鎺uit锛屼綘鐨VBA宸ョ▼灏辨病鏈夊璞℃敮鎸佷簡锛屽墿涓嬩换浣浠g爜閮芥棤娉曠户缁...
绛旓細鍦VBA 鑿滃崟鏍 鈫 宸ュ叿鈫 VBProject灞炴р啋淇濇姢 鍕鹃 鏌ョ湅鏃堕攣瀹氬伐绋嬶紝鐒跺悗鍦ㄤ笅闈㈣緭鍏ュ瘑鐮侊紝鍐嶆鎵撳紑鍗冲彲瀹炵幇淇濇姢銆
绛旓細浣犲彲鑷淇敼銆傝繖鍙ュ彲浠ユ暣涓伐浣滈〉杩涜淇濇姢銆excel榛樿鐨勫伐浣滈〉鍐呮墍鏈夊崟鍏冩牸閮芥槸閿佸畾鐨勶紝鍗充繚鎶ょ姸鎬佹椂锛屼笉鍙紪杈戝拰淇敼浠讳綍鍐呭銆佹牸寮忕瓑锛涘綋闇瑕佸眬閮ㄥ彲缂栬緫淇敼鏃讹紝閫夊畾灞閮ㄧ殑鍗曞厓鏍煎彇娑堝叾閿佸畾灏卞彲浠ュ湪淇濇姢鐘舵佷腑杩涜缂栬緫淇敼銆vba浠g爜濡備笅锛歋election.Locked = False ...
绛旓細Cells.Locked = False Range("H6:Y15").Locked = True Range("H6:Y15").FormulaHidden = False ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True