by bugor (5 Submissions)
Category: Internet/HTML
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 1st December 2002
Date Added: Mon 8th February 2021
Rating:
(1 Votes)
IExplorer. Load informaion from Web form into Excel Sheet
Dim xlApp
Dim xlSheet
Dim xlBook
Dim RemotePath
k=1
TemplatePath="\\MachineName\E\Application\WebReport\Template\Report.xlt"
SavePath="\\MachineName\E\Application\WebReport\Reports\"
Set xlApp=CreateObject("Excel.Application")
xlApp.Workbooks.Add (TemplatePath)
Set xlBook = xlApp.Workbooks(1)
Set xlSheet = xlBook.Sheets(1)
xlSheet.Activate
For each Control in OrderForm
If Control.Title="Profile" Then
xlSheet.Cells(k, 1).Value=Control.name & ": "
xlSheet.Cells(k, 2).Value=Control.Value
k = k + 1
End IF
Next
xlSheet.Range(xlSheet.Cells(1,1),xlSheet.Cells(k,2)).Columns.AutoFit
sDate=GetDate(Date())
sSaveName=OrderForm.CustName.value & "-" & GetTime(Now) & ".xls"
xlSheet.Activate
Call CreateDir(RemotePath)
sSaveName=SavePath & sSaveName
xlBook.SaveAs sSaveName
Set xlSheet = Nothing
If Not xlBook Is Nothing Then Call xlBook.Close
Set xlBook = Nothing
If Not xlApp Is Nothing Then xlApp.Workbooks.Close
If Not xlApp Is Nothing Then xlApp.Application.Quit
Set xlApp = Nothing
bOpen=msgbox("File saved as: " & sSaveName & Chr(13) & "Do you want to open it?" ,VBYesNo)
if bOpen=6 Then window.open sSaveName
End Sub