+ Reply to Thread
Results 1 to 2 of 2

Run time error 91 when opening workbook via vba

  1. #1
    Registered User
    Join Date
    11-19-2015
    Location
    London
    MS-Off Ver
    2010
    Posts
    1

    Run time error 91 when opening workbook via vba

    Hi - I'm trying to pull data from various workbooks using vba, but seem to get a run time error 91 after the first workbook has opened. This is my code:

    Sub ImportBnHData()

    Dim strFilePath As String
    Dim wbTemp As Workbook
    Dim i As Integer


    For i = 1 To 13
    strFilePath = [BacktestingDataFolder] & [BnHDataFiles].Offset(i, 1) & ".xlsx"
    wbTemp = Workbooks.Open(strFilePath)
    wbTemp.Sheets("Summary").Activate

    Next I

    [BacktestingDataFolder] & [BnHDataFiles] are named ranges in the spreadsheet that I am using. Any help would be great!

    Thanks,
    P

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,863

    Re: Run time error 91 when opening workbook via vba

    Use
    Please Login or Register  to view this content.
    moreover
    edit your post and use code tags as required by our http://www.excelforum.com/forum-rule...rum-rules.html
    Best Regards,

    Kaper

+ 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. Run time error 1004 only immediately after opening protected workbook
    By JoeSkittles in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-25-2013, 11:02 AM
  2. Run time error 13, when VBA workbook opening in excel 2007
    By wkslee99 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-04-2013, 03:37 AM
  3. Error 400 displayed after opening a workbook
    By _Jelle_ in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-19-2012, 09:14 AM
  4. Run time Error 91 when opening Excel
    By foxguy in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-18-2011, 09:15 AM
  5. Error when opening workbook
    By stephenw in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-04-2007, 08:55 PM
  6. Error when opening Excel workbook
    By dcournoyer in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-01-2006, 10:55 AM
  7. [SOLVED] Error Opening an Excel Workbook
    By skint4sure@aol.com in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 10-24-2005, 11:05 AM

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