
Vba
mystert
这个作者很懒,什么都没留下…
展开
-
Vba 一张工作表拆分多张工作表
如图,这边需要按照工作内容拆分多个工作表,直接上代码:Sub splitSht()Dim sht As WorksheetDim d As ObjectDim j As Integer Set sht = ThisWorkbook.Worksheets("Sheet1") Set d = CreateObject("scripting.dictionary") With sht rrow = .Range("A65535").End(xlUp).R...原创 2021-10-28 21:14:47 · 4399 阅读 · 3 评论 -
VBA 跑vbscript
Sub test() If Not IsObject(sapApp) Then Set SapGuiAuto = GetObject("SAPGUI") Set sapApp = SapGuiAuto.GetScriptingEngine End If If Not IsObject(Connection) Then Set Connection = sapApp.Children(0) End If If Not ...原创 2021-01-26 21:52:00 · 638 阅读 · 1 评论 -
Vba 字典相加
今天有同事发现需要A列和B列相同的数,把C列相加,这边我们用字典操作最快:source Worksheet :这边我们可以忽略D E F G列,那些只是公式上CODE:Sub Combine2()Dim r As IntegerDim sht_s As Worksheet ' source shtDim sht_r As Worksheet ' result shtSet sht_s = ThisWorkbook.Worksheets("source")..原创 2020-07-05 22:57:55 · 1839 阅读 · 0 评论 -
Vba Word查找关键字在第几页第几行
Sub GetRowIdByFind()Dim myRange As RangeDim sSelection As SelectionActiveDocument.SelectSet myRange = ActiveDocument.ContentmyRange.Find.Execute FindText:="2ºÅÂ¥25Â¥", Forward:=TrueIf myRange.Find.Found = True Then MsgBox "ÄãÒªÕÒµÄÄÚÈÝÔÚ:µ..原创 2020-06-29 23:44:34 · 2626 阅读 · 0 评论 -
Vba Word Shape&TextBox
因为Word里面不一定全部包含在Application Content里面,有些TEXT是存在在TextBox,而TextBox属于Shape,所以可以循环获取Shape来获取TextSub test() Dim Shp As Shape Dim arr() As String For Each Shp In ThisDocument.Shapes Debug.Print Shp.TextFrame.TextRange.Text ...原创 2020-06-29 23:44:47 · 1316 阅读 · 0 评论 -
2020-01-16 Powershell Find&FindNext 改自Vba
这里以找出重复数最大行为列子:Function FindMaxRow(){ param( $sht, $Column, $sTemp ) $findResult = $sht.columns($Column).Find($sTemp,[System.Type]::Missing,[System.Type]::...原创 2020-01-31 17:42:18 · 306 阅读 · 0 评论 -
2020-01-15 Vba Union用法
当要复制EXCEL多行的时候,可以使用UniondimcopyRange as rangeset copyRange = nothingifcopyRange is nothing then set copyRange = sht.range(i & ":" i)else set copyRange =union(copyRange,sht.ra...原创 2020-01-31 17:41:41 · 1280 阅读 · 0 评论 -
Vba 通过EMAIL ADDRESS BOOK获取EMAIL ADRESS
Function GetAddress(AliasName As String)Dim oGAL As ObjectDim myAddrEntry As ObjectDim exchUser As Object' AliasName = "Zhao, Janice (KDC/HR)? "Dim outlookApp As Outlook.ApplicationSet out...原创 2020-01-30 16:13:48 · 554 阅读 · 0 评论 -
Vba RTF(Rich Text) Mail Body Insert File
Sub new_mail() Dim olMailItem As MailItem Dim xlOutLook As Outlook.Application Dim objTxt As Attachment, objExcel As Attachment Dim myCell As Object Set xlOutLook = New Outloo...原创 2020-01-30 16:11:37 · 730 阅读 · 0 评论 -
Powershell/Vba 查看AddressEntry.AddressEntryUserType
Sub ResolveDisplayNameToSMTP()Dim oRecip As Outlook.RecipientDim oEU As Outlook.ExchangeUserDim oEDL As Outlook.ExchangeDistributionListDim xloutlook As Outlook.ApplicationSet xloutlook = Ne...原创 2020-01-29 22:05:25 · 263 阅读 · 0 评论 -
Powershell Excel Find各种参数
在EXCEL中:Powershell是这样的:$sht.find($sTargetValue,[System.Type]::Missing,[System.Type]::Missing,1);最后的参数1 是 xlwhole的值原创 2020-01-29 22:04:48 · 472 阅读 · 0 评论 -
关于Split返回数组,字符串没有切符号
我们知道Split是用于返回数组的:Sub test()Dim arr As Variantarr = Split("abc,bcd,cde", ",")Debug.Print arr(1)End Sub当然,我们也可以只split "abc",这时候返回的数组是一个1维的数组:Sub test()Dim arr As Variantarr = Split...原创 2020-01-29 22:04:16 · 906 阅读 · 0 评论 -
Vba Add WaterMarkText in Pdf(未找到支持中文的参数)
https://community.adobe.com/t5/acrobat/how-to-add-text-to-a-pdf-file-using-access-vba/td-p/5330269https://www.mrexcel.com/board/threads/adding-text-to-pdfs-in-a-folder.954395/Public Sub AddText...原创 2020-01-29 22:03:41 · 805 阅读 · 0 评论 -
Vba/Powershell "Column Number" to Letter(数字转英文字母)
Vba写法:split(cells(1,26).address,"$")(1) ‘26为你要转换为字母的数字运行结果:数字26对应的就是英文字母Z了Powershell写法:$xlapp = New-Object -ComObject "Excel.Application";$xlapp.visible = $true;$wb = $xlapp.wor...原创 2019-05-23 10:08:14 · 1249 阅读 · 0 评论 -
Powershell Excel Add Worksheet After
Worksheets.Add 方法 (Excel)Worksheets.Add method (Excel)05/18/2019 作者 本文内容创建新的工作表、图表或宏工作表。Creates a new worksheet, chart, or macro sheet. 新工作表成为活动工作表。The new worksheet becomes the activ...原创 2019-06-18 12:39:53 · 771 阅读 · 0 评论 -
Vba PowerPoint Shape 各种Type参考(转)
原址:https://docs.microsoft.com/en-us/office/vba/api/office.msoshapetype(如有侵权,请联系删除)Name Value Description mso3DModel 30 3D model msoAutoShape 1 AutoShape msoCallout 2 ...转载 2019-07-09 10:29:47 · 6424 阅读 · 0 评论 -
Powershell/Vba 关于打开Excel时出现We can't update some of the links in your workbook
我们通过Powershell 或者 Vba打开Excel时,有时候会出现如下这种框:还有一种框是updateXXX link,这种框跟上述图片一样,都是为了提示用户EXCEL里面有公式,但是对于Script并不友好,我们可以使用Code解决:Powershell 写法:在打开Excel Path写一句$xlapp.application.AskToUpdateLinks = $fa...原创 2019-07-12 16:09:58 · 1449 阅读 · 0 评论 -
Vba Pdf转JPEG
PDF转JPEG Coding,也可转其他格式文件:首先需要在VBA下勾选"Adobe Acrobat"(根据自己Acrobat版本)直接上CODE:Option ExplicitOption Private ModuleSub ExportAllPDFs() Dim StrFile As String StrFile = Dir("C:\...转载 2019-09-23 13:57:58 · 3515 阅读 · 1 评论 -
深入讲解破解Excel Vba工程密码
Notice:虽然网上好多破解的教程,但是因为EXCEL版本时有更新,很多小白都不知道怎么破解,这边做一个举一反三的教程,做到vba excel工程密码几乎全部可以破解。这边先给出一遍参考文章:https://blog.youkuaiyun.com/baidu_30129309/article/details/52244242这里面的教程讲的是xls文件,但是万一我们的文件是xlsm甚至是xlsb...原创 2019-05-09 15:04:53 · 25936 阅读 · 0 评论