Results 1 to 2 of 2
  1. #1
    jj1 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2014
    Posts
    128

    Code not working

    Private Sub Command126_Click()
    Dim objexcel As Excel.Application
    Dim objworkbook As Excel.Workbook
    Dim objxlsheet As Worksheet
    Set objexcel = CreateObject("Excel.Application")


    ' Set objworkbook = objexcel.Workbooks.Open("C:\MSEXCEL_TEST" & "\" & "test.xlsx")
    Set objworkbook = objexcel.Workbooks.Open(CurrentProject.Path & "\" & "Excel.xlsx")
    Set objxlsheet = objworkbook.ActiveSheet
    Set objexcel = Nothing
    End Sub

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    1. you didnt say which part is not working
    Did you add the EXCEL object library in vbe, menu, tools, references?

    Code:
    Private Sub EditXL()
    Dim xl As excel.Application
    Set xl = CreateObject("excel.application")
    With xl
       .Visible = True
       .Workbooks.Open "C:\MSEXCEL_TEST\test.xlsx"
    End With
    Set xl = Nothing
    end sub

Please reply to this thread with any new information or opinions.

Similar Threads

  1. VBA Code not working
    By data808 in forum Forms
    Replies: 31
    Last Post: 02-06-2014, 08:55 AM
  2. Replies: 2
    Last Post: 06-28-2013, 12:58 PM
  3. VBA Code Not working
    By jo15765 in forum Programming
    Replies: 12
    Last Post: 12-03-2010, 04:01 PM
  4. VB code not working
    By cwwaicw311 in forum Programming
    Replies: 17
    Last Post: 04-26-2010, 07:02 PM
  5. VBA Code for working with IE
    By smikkelsen in forum Programming
    Replies: 3
    Last Post: 04-15-2010, 01:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums