|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
General Scripting - Advice on how to automate something
hi,
I need to automate a process for some users. I have the first part of it figured out, which is to FTP from the mainframe to the server. Then I need to create some kind of script that takes this file, in comma delimited format and create an Excel spreadsheet from it. This will be used as input for some Word documents. My question is how do I automate it? My boss tells me that he wants to make it so all they have to do is “push a button”. Any advice would be appreciated. Thank you. |
|
#2
|
||||
|
||||
|
Quote:
__________________
Click the image if at any point you don't like my decision.Scripting problems? Windows questions? Ask the Windows Guru! |
|
#3
|
|||
|
|||
|
Quote:
hi, no, I dont need to automate the Word portion. All I need to do is get the file from the mainframe, create a spreadsheet from it and put it on the file server where it will be a source for various Word docs. I did create a console application, following advice from another person, but when I run it, I can see the Excel spreadsheet being created. Is there a way I can do this without it showing up? I will want to schedule the job in the future. thanks |
|
#4
|
||||
|
||||
|
With WSH, yes, because you can set the visibility of the Excel application to be hidden.
Your console app may be able to do this as well depending on how it was written. |
|
#5
|
|||
|
|||
|
Quote:
hi. I don't know about WSH, but I can find out. I made an exe out of it and scheduled it in the scheduler. This is the part of my code where I create the file to Excel: Code:
Sub Main()
' testgetfile() ' get file on server
Dim exApp As New Excel.Application
Dim sheet As Excel.Worksheet
Dim c As Integer
Dim r As Integer
Dim conn As System.Data.Odbc.OdbcConnection
Dim dt As New DataTable
Dim da As System.Data.Odbc.OdbcDataAdapter
Dim dr As DataRow
Dim importFolder As String
Dim fileName As String
conn = New Odbc.OdbcConnection
importFolder = "C:\contracts"
fileName = "contract.txt"
conn.ConnectionString = _
"Driver={Microsoft Text Driver (*.txt; *.csv)};" + _
"Dbq=C:\contracts\;" + _
"Extensions=asc,csv,tab,txt;"
da = New System.Data.Odbc.OdbcDataAdapter("select * from [" + fileName + "]", conn)
da.Fill(dt)
Dim wb As Excel.Workbook
Dim i As Integer
i = 0
wb = exApp.Workbooks.Add
'write header
exApp.Visible = True
wb.Activate()
sheet = wb.Worksheets.Add
sheet.Name = "Contracts"
sheet.Cells(1, 1) = "district"
sheet.Cells(1, 2) = "first"
sheet.Cells(1, 3) = "last"
sheet.Cells(1, 4) = "fte"
sheet.Cells(1, 5) = "bu"
sheet.Cells(1, 6) = "title"
sheet.Cells(1, 7) = "days/yr"
sheet.Cells(1, 8) = "salsched"
sheet.Cells(1, 9) = "currange"
sheet.Cells(1, 10) = "step"
sheet.Cells(1, 11) = "startdate"
sheet.Cells(1, 12) = "%pos"
sheet.Cells(1, 13) = "PerDiem"
r = 2
c = 1
For Each dr In dt.Rows
For c = 1 To 13
sheet.Cells(r, c) = dr(i).ToString
i += 1
Next
i = 0
r += 1
Next
wb.SaveAs("conxls.xls")
End Sub
|
|
#6
|
||||
|
||||
|
Change the following line:
Code:
exApp.Visible = True to Code:
exApp.Visible = False |
![]() |
| Viewing: ASP Free Forums > System Administration > Windows Scripting > General Scripting - Advice on how to automate something |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|
|