Click to See Complete Forum and Search --> : save data into Excel file


vivian
December 17th, 1998, 04:46 PM
hi y'all:


I am programming in Visual Basic under windows NT, I try to save some data into an Excel file :"data.xls", it should be very simple, however, the code works well on Windows 98 and one computer running Windows NT, but NOT on another computer which is also running Windows NT.

Anyone knows the workaround? how should I set everything to make it work?


Thanks!

vivian


here is the part of code:

------------------------------------------------

Private Sub Command1_Click()


Dim x1 As Object

Dim sheet As Object

Set x1 = CreateObject("Excel.Application")

x1.Workbooks.Add

Set sheet = x1.ActiveWorkbook.Sheets(1)

x1.Visible = True

For i = 0 To 2

For j = 0 To 9

sheet.Cells(i + 1, j + 1).Value = i + j

Next j

Next i

sheet.SaveAs "c:\temp\data.xls"

x1.Quit

Set x1 = Nothing

End Sub

Vivian
December 17th, 1998, 04:46 PM
hi y'all:


I am programming in Visual Basic under windows NT, I try to save some data into an Excel file :"data.xls", it should be very simple, however, the code works well on Windows 98 and one computer running Windows NT, but NOT on another computer which is also running Windows NT.

Anyone knows the workaround? how should I set everything to make it work?


Thanks!

vivian


here is the part of code:

------------------------------------------------

Private Sub Command1_Click()


Dim x1 As Object

Dim sheet As Object

Set x1 = CreateObject("Excel.Application")

x1.Workbooks.Add

Set sheet = x1.ActiveWorkbook.Sheets(1)

x1.Visible = True

For i = 0 To 2

For j = 0 To 9

sheet.Cells(i + 1, j + 1).Value = i + j

Next j

Next i

sheet.SaveAs "c:\temp\data.xls"

x1.Quit

Set x1 = Nothing

End Sub

Neph
January 5th, 1999, 03:17 PM
Hi,


3 questions:


- is it the same version of Excel ?

- what's the error message ? (Ole automation or ...)

- Does your form show as modal ?