vba代码编程800例_VBA编程常用过程代码实例3135

蓝字关注,加微信NZ9668获资料信息

 VBA解决方案   系列丛书作者 

头条百家平台 VBA资深创作者

_______________________________

看板:下面是我根据我自己20多年的VBA实际利用经验,编写的几部经验教程,全是满满的“干货”,欢迎有需要的朋友联络(WeChat:NZ9668),分享。 1 《VBA代码解决方案》是VBA中各个知识点的讲解,覆盖了绝大多数的知识点。 2 《VBA数据库解决方案》是数据处理的利器; 3 《VBA数组与字典解决方案》中讲解VBA的精华----字典。 4  面向初学及中级以下学员的视频《VBA代码解决方案》正在录制。看视频,“每天20分钟,半年精进VBA”活动正在火热进行中,越早报名,回馈越多。现在第一册48讲内容已经录制完成,第一阶段的优惠活动即将结束。

分享成果,随喜真能量。大家好,今天继续和大家分享VBA编程中常用的过程代码,过程代码在这里讲解的语句非常简单单一,组合起来就是一个大的过程,不积跬步无以至千里。 

VBA过程代码31:代码过程在执行过程中将遇错跳转 Sub MyNZ() on error goto err_handle …………. …………. err_handle: …………. …………. END SUB 代码的解析说明:上述代码过程在执行过程中,如果遇到错误会转跳到标签处往下执行。   7dd9ba8ca35fc62913bf24959a2359b6.png  VBA 过程代码 32 :代码过程在执行过程中将删除一个文件 Sub MyNZ() kill "c:/1.txt" END SUB 代码的解析说明:上述代码过程在执行过程中,将删除一个文件。注意, kill命令删除文件是直接删除,而不是放到回收站中,所以要慎用此命令。   码过程在执行过程中将定制自己的状态栏 Sub MyNZ() Application.StatusBar = "现在时刻: " & Time END SUB 代码的解析说明:上述代码过程在执行过程中,将定制自己的状态栏,状态栏上将显示现在的时刻,如下:   7f2376550d984439ee05b22afd90e66c.png VBA过程代码34:代码过程在执行过程中将恢复默认的状态栏 Sub MyNZ() Application.StatusBar = false END SUB 代码的解析说明:上述代码过程在执行过程中,将定制的状态栏,恢复状态栏的默认状态。  VBA过程代码35:代码过程在执行过程中将用代码执行一个宏 Sub MyNZ() Application.Run macro:=" MyNZ1" END SUB 代码的解析说明:上述代码过程在执行过程中,将执行一个宏 " MyNZ1"  

4fe3b9af26270748594f82d7dda869ad.png

_____________________________ 

有启发 点在看,转给朋友  约作者 请留言,直接交流

更多关联阅读

a4ff46c983337970749cbfa4b2eb7c4c.png

04056796f7296ff3be3edb856d29abf0.png

504759c83a230440a7cfa96f7cf4ce06.png

6278814a5816af2bd7936ff017c7855a.png

OfficeTips Home || VBA Section || General Section || Download Section || Privacy Policy Useful PowerPoint VBA code snippets More Sharing Services Share | Share on gmail Share on google Share on facebook Share on twitter Determine the current slide in the Slide View mode: Sub SlideIDX() MsgBox "The slide index of the current slide is:" & _ ActiveWindow.View.Slide.SlideIndex End Sub Determine the current slide in Slide Show mode: Sub SlideIDX() MsgBox "The slide index of the current slide is:" & _ ActivePresentation.SlideShowWindow.View.Slide.SlideIndex End Sub Difference between SlideIndex property and SlideNumber property: The SlideIndex property returns the actual position of the slide within the presentation. The SlideNumber property returns the PageNumber which will appear on that slide. This property value is dependent on "Number Slide from" option in the Page Setup. Go to Page Setup and Change the value of "Number Slide from" to 2 and then while on the 1st slide in Slide View run the following Macro Sub Difference() MsgBox "The Slide Number of the current slide is:" & _ ActiveWindow.View.Slide.SlideNumber & _ " while the Slide Index is :" & _ ActiveWindow.View.Slide.SlideIndex End Sub Macro to exit all running slide shows: Sub ExitAllShows() Do While SlideShowWindows.Count > 0 SlideShowWindows(1).View.Exit Loop End Sub Code to refresh current slide during the slide show: Sub RefreshSlide() Dim lSlideIndex As Long lSlideIndex = SlideShowWindows(1).View.CurrentShowPosition SlideShowWindows(1).View.GotoSlide lSlideIndex End Sub Code to reset animation build for the current slide during the slide show: Sub ResetSlideBuilds() Dim lSlideIndex As Long lSlideIndex = SlideShowWindows(1).View.CurrentShowPosition SlideShowWindows(1).View.GotoSlide lSlideIndex, True End Sub Insert a slide after current slide Sub InsertSlide() Dim oView As View With ActivePresentation.Slides Set oView = ActiveWindow.View oView.GotoSlide .Add(oView.Slide.SlideIndex + 1, _ ppLayoutTitleOnly).SlideIndex Set oView = Nothing End With End Sub Copyright 1999-2011 (c) Shyam Pillai. All rights reserved.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值