+ Reply to Thread
Results 1 to 5 of 5

Excel 2016 creating a new workbook using VBA gives error for some users on some computers

  1. #1
    Registered User
    Join Date
    09-06-2016
    Location
    Leeds, UK
    MS-Off Ver
    2016
    Posts
    3

    Post Excel 2016 creating a new workbook using VBA gives error for some users on some computers

    Hi guys,

    We have a problem thats had all the devs in our office scratching our heads. This is particular to office 16/ windows 10 and can only be replicated with certain combinations of excel files, computers and users.

    The issue is that for some users on some machines when running a report they are getting:
    "Excel cannot insert the sheets into the destination workbook, because it contains fewer rows and columns than the source workbook."

    The same user on different machine works.

    A different user on the same machine works.

    Here is the relevent code:

    Dim wbTemplate As Excel.Workbook, wbData As Excel.Workbook, wsData As Excel.Worksheet

    Set wbTemplate = Application.ActiveWorkbook

    Set wbData = Application.Workbooks.Add

    Application.DisplayAlerts = False
    wbTemplate.Sheets(Array("Summary", "Detail")).Copy before:=wbData.Sheets(1)

    The error throws on the last line of code above. Any ideas?

    Thanks very much

    ~TheShoe

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Excel 2016 creating a new workbook using VBA gives error for some users on some comput

    It sounds like some of the computer might be setup with a default file format as .xls instead of .xlsx.

    Squeeze in the following line before you begin Adding workbooks:
    Please Login or Register  to view this content.
    To manually coerce the machine to start using .xlsx workbooks. The next workbook created will conform to 1.04 million row standard.
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Registered User
    Join Date
    09-06-2016
    Location
    Leeds, UK
    MS-Off Ver
    2016
    Posts
    3

    Re: Excel 2016 creating a new workbook using VBA gives error for some users on some comput

    Thanks very much!

    That worked perfectly.

    You are one excellent dude.

  4. #4
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Excel 2016 creating a new workbook using VBA gives error for some users on some comput

    Hi,

    You might also use simply
    Please Login or Register  to view this content.
    to create a new workbook with the specified sheets.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  5. #5
    Registered User
    Join Date
    09-06-2016
    Location
    Leeds, UK
    MS-Off Ver
    2016
    Posts
    3

    Re: Excel 2016 creating a new workbook using VBA gives error for some users on some comput

    Thanks xInitwit

    It looks like the issue was something to do with the office install or perhaps some group policy. https://support.office.com/en-us/art...7-23ff5f381fb5

    On a working pc the option ‘Excel Workbook (*.xlsx)’ is selected however on the not working system its not got that option, it only has ‘Excel Workbook’ missing the file extension inside the brackets.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Excel 2016 Error in Formula or its a bug?
    By pattyyy in forum Excel General
    Replies: 16
    Last Post: 07-18-2016, 12:01 PM
  2. Excel Mac 2016 VBA error, need help
    By BlakeMile in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-23-2015, 03:09 AM
  3. Auto Numbering and Saving for users on different computers & networks
    By robbyb05 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-18-2015, 10:51 AM
  4. Using Excel to connect to SQL for multiple users on multiple computers
    By chad.portman in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-09-2014, 01:39 PM
  5. Replies: 1
    Last Post: 03-27-2014, 02:08 PM
  6. Replies: 1
    Last Post: 09-06-2010, 01:19 AM
  7. excel compile error. Only some computers?
    By Bob Aylward in forum Excel General
    Replies: 0
    Last Post: 12-13-2005, 03:20 PM

Tags for this Thread

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