shaileshkaijkar
Member
hi
i am working on rs view32 in which i want to do report in excel.i write the script as follows but it doesnt work.
there is a error "file is not found".i think that excel file is not genrating.
Sub createexclefile()
Dim objExcel As Object
Dim sha As String
Dim sk As Tag
Set objExcel = CreateObject("Excel.Application")
sha = gProject.Path & "\VBA\ssk.xls"
objExcel.Workbooks.Open (sha)
objExcel.Application.Visible = True
objExcel.Application.windostate = -4137
objExcel.Application.activwindow.windostate = -4137
sHeight = objExcel.Height
objExcel.worksheets("sourcedata").activate
objExcel.Column(1).columnwidth = 13.5
objExcel.Column(2).columnwidth = 19
sk.Value = 15
If sHeight < 350 Then
objExcel.activewindow.Zoom = 50
Else
If sHeight < 440 Then
objExcel.activewindow.Zoom = 75
End If
End If
For nColumn = 1 To 7
objExcel.Column(nColumn).horizantalalignment = -4108
Next nColumn
With objExcel
.Rows(1).Font.Bold = True
.cells(1, 1).Value = "time and date"
.cells(1, 2).Value = "recipe name"
.cells(1, 3).Value = "coffee"
.cells(1, 4).Value = "sugar"
.cells(1, 5).Value = "cream"
.cells(1, 6).Value = "cocoa"
.cells(1, 7).Value = "irish"
.cells(1, 8).Value = sk.Value
End With
End Sub
i am working on rs view32 in which i want to do report in excel.i write the script as follows but it doesnt work.
there is a error "file is not found".i think that excel file is not genrating.
Sub createexclefile()
Dim objExcel As Object
Dim sha As String
Dim sk As Tag
Set objExcel = CreateObject("Excel.Application")
sha = gProject.Path & "\VBA\ssk.xls"
objExcel.Workbooks.Open (sha)
objExcel.Application.Visible = True
objExcel.Application.windostate = -4137
objExcel.Application.activwindow.windostate = -4137
sHeight = objExcel.Height
objExcel.worksheets("sourcedata").activate
objExcel.Column(1).columnwidth = 13.5
objExcel.Column(2).columnwidth = 19
sk.Value = 15
If sHeight < 350 Then
objExcel.activewindow.Zoom = 50
Else
If sHeight < 440 Then
objExcel.activewindow.Zoom = 75
End If
End If
For nColumn = 1 To 7
objExcel.Column(nColumn).horizantalalignment = -4108
Next nColumn
With objExcel
.Rows(1).Font.Bold = True
.cells(1, 1).Value = "time and date"
.cells(1, 2).Value = "recipe name"
.cells(1, 3).Value = "coffee"
.cells(1, 4).Value = "sugar"
.cells(1, 5).Value = "cream"
.cells(1, 6).Value = "cocoa"
.cells(1, 7).Value = "irish"
.cells(1, 8).Value = sk.Value
End With
End Sub