Results 1 to 12 of 12

Thread: excel file

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2003
    Location
    Worcester, MA
    Posts
    782

    excel file

    I am working with access in vb anjd i want to have there be a file in the "\" directory called excel1, how do i do this in my application?
    C#.net, VB, C++, Java, VS 2005/2008
    Dont' forget to rate posts that are helpful to you.

  2. #2
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697
    Your question isn't very clear? Do you want to create a file named excel1 in the same directory as your app?

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2003
    Location
    Worcester, MA
    Posts
    782
    yes exactly!
    C#.net, VB, C++, Java, VS 2005/2008
    Dont' forget to rate posts that are helpful to you.

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2003
    Location
    Worcester, MA
    Posts
    782
    also it wont let me do
    VB Code:
    1. appExcel.Range("B1").Value = text1.Text
    C#.net, VB, C++, Java, VS 2005/2008
    Dont' forget to rate posts that are helpful to you.

  5. #5
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697
    The following link will give you an example of how to do what you're after. HTH

    http://www.erlandsendata.no/english/vba/adodao/

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2003
    Location
    Worcester, MA
    Posts
    782
    sort of but i dont really understand it all, and i dont need to use access jsut excel.
    C#.net, VB, C++, Java, VS 2005/2008
    Dont' forget to rate posts that are helpful to you.

  7. #7
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697
    If you just want to use Excel then this thread is what you're after.

    http://www.visualbasicforum.com/show...ght=save+excel

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2003
    Location
    Worcester, MA
    Posts
    782
    why cant i use this line


    VB Code:
    1. appExcel.Range("B1").Value = text1.Text


    ?????
    C#.net, VB, C++, Java, VS 2005/2008
    Dont' forget to rate posts that are helpful to you.

  9. #9
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697
    If you have declared everything then it should work. Can you post all the code you're working with so we can have a look to see if you may hve over looked something.

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2003
    Location
    Worcester, MA
    Posts
    782
    VB Code:
    1. 'Reference Microsoft Excel 8.0 Library Object or up from your program first
    2. Sub command1_click()
    3.   Dim appExcel As Excel.Application
    4.   Set appExcel = New Excel.Application
    5.   appExcel.DisplayAlerts = False
    6.   appExcel.Visible = False
    7.   appExcel.ScreenUpdating = False
    8.   appExcel.Workbooks.Open FileName:="c:\myfile.xls"
    9.   appExcel.Worksheets("Sheet1").Select
    10.   Range("A2").Value = text2.Text
    11.   appExcel.ActiveWorkbook.Close Savechanges:=True
    12.   appExcel.Quit
    13.   Set appExcel = Nothing
    14.   MsgBox "Process Complete!"
    15. End Sub
    C#.net, VB, C++, Java, VS 2005/2008
    Dont' forget to rate posts that are helpful to you.

  11. #11
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697
    There is nothing wrong with your code???

    What line does the error occur?/?

  12. #12

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2003
    Location
    Worcester, MA
    Posts
    782
    there is no error , but the text doesnt go to the block on the excel form.
    C#.net, VB, C++, Java, VS 2005/2008
    Dont' forget to rate posts that are helpful to you.

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