|
Subject:
|
problem while saving the excel sheet
|
|
Posted By:
|
icyindian
|
Post Date:
|
9/19/2003 2:02:10 AM
|
Private Sub createAndSaveExcelSheet(ByRef lRS As ADODB.Recordset, lDate As Date, ByRef lXLapp As Excel.Application) Dim lXLwb As Excel.Workbook Dim lXLws As Excel.Worksheet Dim fso As New FileSystemObject Dim lICount As Integer Set lXLapp = New Excel.Application lXLapp.Visible = False Set lXLwb = lXLapp.Workbooks.Add Set lXLws = lXLwb.ActiveSheet lXLws.Rows(6).CopyFromRecordset lRS Dim intcol As Integer MsgBox "excel sheet open" lXLws.Cells(5, 1) = "Card No" lXLws.Cells(5, 2) = "Name" lXLws.Cells(5, 3) = "Emp Code" lXLws.Cells(5, 4) = "Department" For intcol = 1 To 5 lXLws.Cells(5, intcol).Font.Size = 12 lXLws.Cells(5, intcol).Font.Bold = True Next MsgBox "doing autofit" For lICount = 1 To lRS.Fields.count lXLws.Columns.AutoFit Next lICount MsgBox "autofit done" lXLws.Cells(1, 1).Font.Size = 18 lXLws.Cells(1, 1) = "SWIPE CARD REPORT GENERATED ON " & VBA.Date & " at " & VBA.Time lXLws.Cells(3, 1).Font.Size = 16 lXLws.Cells(3, 1) = "People absent on " & lDate MsgBox "parent stuff" lXLapp.Parent.Windows(lXLwb.Name).Visible = True MsgBox "switch off alerts to avoid overwrite dialog box by the excel application" 'switch off alerts to avoid overwrite dialog box by the excel application lXLapp.DisplayAlerts = False MsgBox "alert off and saving now" --> lXLwb.SaveAs (App.Path & "\" & VBA.Format(lDate, "mmddyyyy")) lXLapp.DisplayAlerts = True lXLwb.Close Set lXLwb = Nothing Set lXLws = Nothing Set lXLapp = Nothing MsgBox "create and save excel done" End Sub
all the code is working fine till the msgbox" alert off and saving now" the problem is coming while i try to save the excel sheet. i have marked with an arrow. this error is coming i=on the pc where vb is not installed. please help me to overcome this error.
|
|
Reply By:
|
bitner
|
Reply Date:
|
9/19/2003 8:04:34 AM
|
Have you tried to Save the worksheet you are working with, instead of the workbook? ex: lXLwb.SaveAs fileName
|
|
Reply By:
|
Yehuda
|
Reply Date:
|
9/19/2003 8:05:36 AM
|
Does the machine have the VB runtime dlls on it (MSVBVM60.DLL, VBST6Kit.dll)? Thats what the issue looks like.
Yehuda
|
|
Reply By:
|
icyindian
|
Reply Date:
|
9/20/2003 1:33:01 AM
|
hi bitner : i tried it already but no change..error at same position
hi yehuda : tried by copying the dll's.. but no change..
|