+ Reply to Thread
Results 1 to 3 of 3

VBA will work in one workbook, but not another???

  1. #1
    Forum Contributor
    Join Date
    07-22-2009
    Location
    Minneapolis, MN
    MS-Off Ver
    2016
    Posts
    220

    VBA will work in one workbook, but not another???

    I have the following code in a spreadsheet. When I run it, always get an error on line 21; sometimes it's #70 (path not found) and occasionally it's #76 (permission denied).

    However, when I copy the code to a blank workbook (along with the named ranges), the code works perfectly; everytime.

    This is all stored in the same folder in a network drive, so I thought perhaps it was a network permission or something goofing things up, but the blank workbook debunked that theory.

    Here is the code; can anyone tell me some ideas as to why I might be experiencing this problem? It's vague I know, but I don't know what else to say. If you have some ideas of what I could try to help narrow down the culprit, I'm all ears.

    Thanks!

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor Cerbera's Avatar
    Join Date
    07-06-2010
    Location
    Rotorua, New Zealand
    MS-Off Ver
    Excel 2007, 2013, 2016 & 365
    Posts
    137

    Re: VBA will work in one workbook, but not another???

    Hi, Haven't been able to work through your code, however I was wondering if the new workbook is saved in the same directory as the original one before running the code and whether this could cause the different behaviour? Not sure if the current folder location would affect any of your code. It's a long shot but thought I'd mention it as I haven't got time to go through it properly to check.

  3. #3
    Forum Contributor
    Join Date
    07-22-2009
    Location
    Minneapolis, MN
    MS-Off Ver
    2016
    Posts
    220

    Re: VBA will work in one workbook, but not another???

    Hi,
    Thanks for the reply. Yes, the filepath for both spreadsheets is the same on the network drive. The problem is the same though if I save the real spreadsheet and test spreadsheet and run them on my desktop too.

    I've attached a copy of the test spreadsheet I've been trying out. I just create folder on my desktop, create a new folder inside of that, and save the spreadsheet inside of that. I also added some other files in there too (jpg's, pdf's, doc's, etc) to test that it copies the files from one folder to another properly.

    This test worksheet works properly, but the exact same RENAME_PROJECT_FOLDER macro copied to another spreadsheet does not; sooo weird.
    Attached Files Attached Files

+ 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. Have to select XL workbook twice to work with it.
    By amsanborn in forum Excel General
    Replies: 2
    Last Post: 12-19-2013, 04:30 AM
  2. [SOLVED] Macro work in personal workbook, doesn't work in other workbooks
    By Centexcel in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-30-2013, 11:47 AM
  3. Have to open workbook twice to work with it.
    By amsanborn in forum Excel General
    Replies: 2
    Last Post: 11-26-2012, 02:03 PM
  4. Workbook to work on just on machine
    By suny100 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-25-2011, 09:31 AM
  5. My links to another workbook don't work
    By Tony M in forum Excel General
    Replies: 2
    Last Post: 05-16-2006, 12:00 PM

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