首页 > TAG信息列表 > ThisWorkbook
VBA访问网络
Private Sub CommandButton1_Click() uploadData1 ("http://192.168.1.77:66/api/mes/TVbox?a=" + TextBox1.Text + "&b=" + TextBox2.Text + "&c=" + TextBox3.Text + "&d=" + TextBox4.Text + "&el=Excel循环文件夹汇总所有下载发票的Excel文件数据
Dim a As String, n As Integer, wbs As Workbook ThisWorkbook.Sheets(1).Cells.Clear a = Dir(ThisWorkbook.Path & "\*.xls") 'Application.DisplayAlerts = False 'Workbooks.Open ThisWorkbook.Path & "\" &循环文件夹汇总所有发票开具Excel文件数据
不打开Excel文件提取数据? Dim a As String, n As Integer, wbs As Workbook ThisWorkbook.Sheets(1).Cells.Clear a = Dir(ThisWorkbook.Path & "\*.xlsx") 'Application.DisplayAlerts = False Dim con As New ADODB.Connection Dim rs As New其他VBA相关语句
'自动获取已使用区域'col = Selection.Column '获取表格开始单元格的列数'Row = Selection.Row '获取表格开始单元格的行数 'ActiveThisWorkbook.Sheets(1).Select ActiveSheet.UsedRange.Select Sheets.Add After:=Sheets(Sheets.Count) 'For i = 2 To Sheets.CountVBA实例:高考分数投档指数分析(模块3.同步代码部分)
Sub 重点大学同步代码() Dim I% Dim rng As range, rng1 As range, rng2 As range For Each rng In ThisWorkbook.Worksheets("重点大学明细").range("C2", ThisWorkbook.Worksheets("重点大学明细").[C2].End(xlDown)) For Each rng1 In ThisWorkboxlsx 表格合并VBA代码
前提: 每个表格的数据格式一致,包含有表头、子表格不能有刷选操作。 Sub 合并() If MsgBox("是否要汇总明细表?", vbYesNo + vbInformation) = vbNo Then '提示是否汇总 Exit Sub End If On Error Resume Next '如遇错误继续运行 ApplicatVBA里,workbook.path不是全名,而workbook.fullname才是。而file.path就是全名,没有file.fullname
1 VBA 和 Application--Excel下的命名系统 2.1 workbooks 工作簿有fullname属性 fullname= path+ "\" + name ThisWorkbook.FullName 文件全名 ThisWorkbook.Path 文件路径 ThisWorkbook.Name 文件名 ThisWorkbook.FullName =VBA实战:电商仓储错拣逆还及退货上架(下)
接上讲: 中讲已经完成了主程序的设计,这一讲说一下其它功能按钮的实现和一些小细节; 一、功能按钮: 1 '显示按钮 2 Private Sub CommandButton2_Click() 3 Application.Visible = True 4 End Sub 5 '隐藏按钮 --防止不小心点击,直接隐藏工作表 6 Private Sub CommandButton3_ClVB 替换word文档中页眉页脚的文字
查找资料,替换成功的只有替换页面内容的文字 Sub docs()Dim wordapp Set wordapp = CreateObject("Word.Application") With wordapp .documents.Open (ThisWorkbook.Path & "test.docx") .Visible = True .activedocument.content.Find.Execut动态执行文本vba代码
动态执行文本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 &amVBA 格式化excel数据表 (数据分列)
Sub ImportData()'' Copy Data from one workbook to the Current Workbook' Place the macro file in the same folder as the source file' p = ThisWorkbook.Path & "\" f = Dir(p & "*.xlsx") ApplicatioVBA 批量把 worksheet保存为workbook
批量把 worksheet保存为workbook 方法1 Sub saveas() '这个是不是就是做打表工具的一部分?比如这就是导表 Dim wb As Workbook Dim sht As Worksheet Dim strpath As String strpath = ThisWorkbook.path & "\" ‘这样能自动读路