CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 1999
    Posts
    15

    save data into Excel file



    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



  2. #2
    Join Date
    Jan 1999
    Posts
    6

    Re: save data into Excel file



    Hi,


    3 questions:


    - is it the same version of Excel ?

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

    - Does your form show as modal ?



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured