1. 引用 API 函数 ' API函数Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _ ByVal lpClassName As String, _ ByVal lpWindowName As String) As LongPublic Declare Function ShowWindow Lib "user32" ( _ ByVal hwnd As
动态执行文本vba代码 Public Sub StringExecute(s As String) Dim vbComp As Object Set vbComp = ThisWorkbook.VBProject.VBComponents.Add(1) vbComp.Name = "aaa" vbComp.CodeModule.AddFromString "Sub foo" & vbCrLf & s & vbCrLf & "
批量将CSV导入access alt+f11 打开access的vbe环境 Sub test() Dim SQL As String Dim MyPath As String Dim MyPathDb As String Dim MyFile As String MyPath = "D:\temp\*.CSV" MyPathDb = "D:\temp" MyFile = Dir(MyPath) Do SQL = "insert into 110 selec
'批量替换字符 Sub Test() Dim i As Integer ).Value = "已激活" Then Cells(i, ).Value = "Active" End If Next End Sub Sub Test() Dim rowsNum, i, j, equalRowsNum As Integer '声明变量 rowsNum = ActiveSheet.UsedRange.Rows.Count '获得行数 To rowsNum '遍历全部行数 ).
1.超链接地址提取 Function GetURL(rng As Range) As String On Error Resume Next GetURL = rng.Hyperlinks(1).Address End Function 2.表格多sheet页的目录跳转制作 (代码走查表为例) (1)针对整个工作簿,即 ThisWorkbook,输入以下代码. Sub 超链接() Dim ct As Long Sheet5.Rows("2:100000").ClearConten
Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd A
问题源自:Excel 一个困扰我很长时间的代码转换问题-Word-ExcelHome技术论坛 - http://club.excelhome.net/thread-1334942-1-1.html Sub df() Dim pa As Paragraph, re As Object ActiveDocument.Range.Find.Execute "_^13", , , 2, , , , 0, 0, "", 2 '第一个2决定是否通配,第二个决定是否全部替换 S