+ Reply to Thread
Results 1 to 8 of 8

Marco code working in 2007 but not 2010

  1. #1
    Registered User
    Join Date
    10-10-2012
    Location
    Reading, England
    MS-Off Ver
    Excel 2010
    Posts
    4

    Angry Marco code working in 2007 but not 2010

    Hi All,

    I am new to macro's and have built this code

    Sub GetDataFromClosedWorkbook()

    'Open Leads
    Dim wb As Workbook

    Application.ScreenUpdating = False ' turn off the screen updating
    Set wb = Workbooks.Open("O:\GPS\Lead Reports\Data\Open Leads.xlsx", True, True)
    ' open the source workbook, read only
    With ThisWorkbook.Sheets("Open Leads")
    ' read data from the source workbook
    .Range("A2:Q10001").Value = wb.Worksheets("Sheet1").Range("A1:Q10000").Value
    '.Cells(1, 2).Value = wb.Worksheets("Sheet1").Cells(1, 2).Value
    '.Cells(1, 3).Value = wb.Worksheets("Sheet1").Cells(1, 3).Value
    '.Cells(1, 4).Value = wb.Worksheets("Sheet1").Cells(1, 4).Value

    '.Range("A10").Formula = wb.Worksheets("Sheet1").Range("A10").Formula
    ' .Range("A11").Formula = wb.Worksheets("Sheet1").Range("A20").Formula
    ' .Range("A12").Formula = wb.Worksheets("Sheet1").Range("A30").Formula
    '.Range("A13").Formula = wb.Worksheets("Sheet1").Range("A40").Formula
    End With
    wb.Close False ' close the source workbook without saving any changes
    Set wb = Nothing ' free memory
    Application.ScreenUpdating = True ' turn on the screen updating

    It works on computer running Excel 2007 but not on excel 2010,(which is my Boss's computer)! Can anyone explain why?? I need it to work for a presentation on Thursday.

    Sutty31

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Marco code working in 2007 but not 2010

    All but one line of code is commented out, is it meant to be like that?

    Also, how is it 'not working'?

  3. #3
    Registered User
    Join Date
    10-10-2012
    Location
    Reading, England
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Marco code working in 2007 but not 2010

    I dont think so i think that happend when i posted the code on the blog,

    Not working means it comes back with" 'O:\GPS\Lead Report\Data\open leads.xlsx' can not be found, check spelling". which i have done and it is all ok

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Marco code working in 2007 but not 2010

    Is is a network drive?

    Have you checked the full path?

  5. #5
    Registered User
    Join Date
    10-10-2012
    Location
    Reading, England
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Marco code working in 2007 but not 2010

    Yep a network drive, all the files are with the network drive which is the O:\ drive.

    I just checked my workings out and get it is supposed to be commented out.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Marco code working in 2007 but not 2010

    If it is a network drive try using it's UNC path.

  7. #7
    Registered User
    Join Date
    10-10-2012
    Location
    Reading, England
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Marco code working in 2007 but not 2010

    would that be \\GPS\Lead Reports\Data
    do i put .xlsx on?

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Marco code working in 2007 but not 2010

    I don't think that's it.

    Normally there would be a server name at the start.

    Check what O: is mapped to.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1