小编Nat*_*rne的帖子

VBScript循环遍历文件夹中的所有文件

我有代码在单个文件上执行该过程,任何人都可以更改此脚本,以便循环遍历文件类型为" .LTR " 的目录"H:\ Letter Display\Letters"中的所有文件,并将它们全部保存:

 Const ForReading = 1
 Const ForWriting = 2

 Set objFSO = CreateObject("Scripting.FileSystemObject")
 Set objFile = objFSO.OpenTextFile("H:\Letter Display\Letters\LTRPRT__00000008720000000001NI-K-RMND.LTR",    ForReading)


 str1000 = "1000"
 str1100 = "1100"
 str1200 = "1200"
 str9990 = "9990"

 arrCommas1 = Array(14,31,41,59,70,81,101,111,124,138)
 arrCommas2 = Array(14,31,41,55,79,144,209,274,409,563,589,608,623)
 arrCommas3 = ArraY  (14,32,41,73,83,97,106,156,167,184,188,195,207,260,273,332,368,431,461,472,593,617,666,772,810,834,848,894,898)
 arrCommas4 = Array(14,31,41)

 Do Until objFile.AtEndOfStream
   strLine = objFile.ReadLine

   If Left(strLine, 4) = str1000 then
     intLength = Len(strLine)
     For Each strComma in arrCommas1
       strLine = Left(strLine, strComma - 1) + "," _
         + Mid(strLine, …
Run Code Online (Sandbox Code Playgroud)

csv vbscript batch-file

10
推荐指数
2
解决办法
7万
查看次数

打开Excel文件并另存为.XLS

我有以下代码,我希望它打开我保存为.xlsx的文件,然后使用相同的文件名再次保存它们,但这次是.xls文件,以便它们与Excel 2003兼容

Set app = CreateObject("Excel.Application")
Set fso = CreateObject("Scripting.FileSystemObject")

For Each f In fso.GetFolder("Y:\Billing_Common\autoemail").Files
  If LCase(fso.GetExtensionName(f)) = "xlsx" Then
    Set wb = app.Workbooks.Open(f.Path)

app.DisplayAlerts = False

wb.SaveAs "*.xls*"
wb.Close SaveChanges=True
app.Close
app.Quit

  End if

Set f = Nothing
Set fso = Nothing
Next
Run Code Online (Sandbox Code Playgroud)

vbscript excel ms-office

5
推荐指数
2
解决办法
5万
查看次数

VBScript SMTP 服务器

我已将其设置为通过 Outlook 客户端自动发送电子邮件,是否可以更改此代码以直接通过 SMTP 服务器工作?谁能帮我做这件事?

任何帮助将不胜感激,谢谢!

Set app = CreateObject("Excel.Application")
Set fso = CreateObject("Scripting.FileSystemObject")

For Each f In fso.GetFolder("Y:\Billing_Common\autoemail").Files
  If LCase(fso.GetExtensionName(f)) = "xls" Then
    Set wb = app.Workbooks.Open(f.Path)


set sh = wb.Sheets("Auto Email Script")
row = 2
name = "Customer"
email = sh.Range("A" & row)
subject = "Billing"
the = "the"
LastRow = sh.UsedRange.Rows.Count

For r = row to LastRow
    If App.WorkSheetFunction.CountA(sh.Rows(r)) <> 0 Then 
        SendMessage email, name, subject, TRUE, _
        NULL, "Y:\Billing_Common\autoemail\Script\energia-logo.gif", 143,393
        row = row + 1
        email …
Run Code Online (Sandbox Code Playgroud)

vbscript outlook smtp

1
推荐指数
1
解决办法
4574
查看次数

标签 统计

vbscript ×3

batch-file ×1

csv ×1

excel ×1

ms-office ×1

outlook ×1

smtp ×1