crmaho01
asked on
Change VBA to VB executable
I currently have a bat file to copy some DAT files and then open excel to format the DAT files, save them as .xls, and then email them. This will work with no problems on a client machine that has office. I am now needing to move the process to a server 2000 machine. Any ideas?
MY BAT FILE
cd Mania
set DATE=
set TODAY=%DATE:~4,2%%DATE:~7, 2%%DATE:~1 0,4%
copy ..\MANIA.DAT MAN%TODAY%.DAT
copy ..\PMAN.DAT PIZZATRACK%TODAY%.DAT
c:
cd "C:\Program Files\Microsoft Office\OFFICE11"
excel "C:\Documents and Settings\cxm\My Documents\Automation Process\Auto1.xls"
excel "C:\Documents and Settings\cxm\My Documents\Automation Process\Auto2.xls"
MY VBA Code from the excel files
Range("A1").Select
ActiveCell.FormulaR1C1 = "Date"
Range("B1").Select
ActiveCell.FormulaR1C1 = "Time"
Range("C1").Select
ActiveCell.FormulaR1C1 = "Type"
Range("D1").Select
ActiveCell.FormulaR1C1 = "Number"
Range("A2").Select
Application.CutCopyMode = False
With ActiveSheet.QueryTables.Ad d(Connecti on:="TEXT; Z:\Mania\M AN" & Format(Now(), "mmddyyyy") & ".DAT" _
, Destination:=Range("A2"))
.Name = "MAN" & Format(Now(), "mmddyyyy")
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimi ter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimite r = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(5, 2, 2, 2, 1)
.TextFileTrailingMinusNumb ers = True
.Refresh BackgroundQuery:=False
End With
ActiveWorkbook.SaveAs ("C:/MAN" & Format(Now(), "mmddyyyy"))
ActiveWorkbook.SendMail "email.address@company.com ", "MAN" & Format(Now(), "mmddyyyy")
Application.Quit
MY BAT FILE
cd Mania
set DATE=
set TODAY=%DATE:~4,2%%DATE:~7,
copy ..\MANIA.DAT MAN%TODAY%.DAT
copy ..\PMAN.DAT PIZZATRACK%TODAY%.DAT
c:
cd "C:\Program Files\Microsoft Office\OFFICE11"
excel "C:\Documents and Settings\cxm\My Documents\Automation Process\Auto1.xls"
excel "C:\Documents and Settings\cxm\My Documents\Automation Process\Auto2.xls"
MY VBA Code from the excel files
Range("A1").Select
ActiveCell.FormulaR1C1 = "Date"
Range("B1").Select
ActiveCell.FormulaR1C1 = "Time"
Range("C1").Select
ActiveCell.FormulaR1C1 = "Type"
Range("D1").Select
ActiveCell.FormulaR1C1 = "Number"
Range("A2").Select
Application.CutCopyMode = False
With ActiveSheet.QueryTables.Ad
, Destination:=Range("A2"))
.Name = "MAN" & Format(Now(), "mmddyyyy")
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimi
.TextFileTabDelimiter = False
.TextFileSemicolonDelimite
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(5, 2, 2, 2, 1)
.TextFileTrailingMinusNumb
.Refresh BackgroundQuery:=False
End With
ActiveWorkbook.SaveAs ("C:/MAN" & Format(Now(), "mmddyyyy"))
ActiveWorkbook.SendMail "email.address@company.com
Application.Quit
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It is possible, but I have never done it myself (the closest I've done is create an email without sending) - from what I have seen it takes far too much work. It would be easiest to use the functionality of Office if it meets your needs.
Unless you've got a proper version VB, I wouldn't even consider a route other than installing Office.
If you have got VB, it will be a lot of work to get the data formatted suitably too.
Unless you've got a proper version VB, I wouldn't even consider a route other than installing Office.
If you have got VB, it will be a lot of work to get the data formatted suitably too.
ASKER