+ Reply to Thread
Results 1 to 6 of 6

ActiveWorkBook is returning an object with <no variables>

  1. #1
    Registered User
    Join Date
    04-12-2013
    Location
    Virginia, USA
    MS-Off Ver
    MSO2010 on Win7
    Posts
    4

    ActiveWorkBook is returning an object with <no variables>

    I am going crazy trying to understand what is wrong with my code. The entire routine is down below.

    I'm using Workbook.OpenText to get a TXT file. I then use
    Please Login or Register  to view this content.
    which is the recommended practice from what I've seen on the forums. The problem is, my Watch Window shows a + symbol, but when I expand it, it says <no variables> (I have a break point so that I should be able to see the data). I get no errors on the following lines when I grab the number of non-blank rows (my function), and I can print the wb.Name as well. But when I try to set the values in the Range to an array, they're all blanks.

    Perhaps related, I get a "Range of object '_Worksheet' failed" error if I try to use DataWS.Range() instead of DataWS.Cells() in the For Loop down below.

    Does anyone know why I can't see the object data in the Watch Window, and why my array values are all blank strings? Thanks in advance!!!

    Colin

    P.S. I'm using Option Explicit and am using the standard Excel error handler during debugging.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,918

    Re: ActiveWorkBook is returning an object with <no variables>

    I don't see any code defining:
    mLastRow() - is that a udf somewhere?

    How do you initialize: kCatStrmProdName & kCatStrmSngQty? How do you know they aren't = 0?
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    04-12-2013
    Location
    Virginia, USA
    MS-Off Ver
    MSO2010 on Win7
    Posts
    4

    Re: ActiveWorkBook is returning an object with <no variables>

    Thanks for the reply.

    Yes, mLastRow is a User Defined Function that is successfully returning a non-zero integer. The code is:
    Please Login or Register  to view this content.
    And the constants are:
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    04-12-2013
    Location
    Virginia, USA
    MS-Off Ver
    MSO2010 on Win7
    Posts
    4

    Re: ActiveWorkBook is returning an object with <no variables>

    At the very least, can someone explain why the Watch Window would say that the workbook wb has <no variables>? There are no errors reported and the Debug line gives me the name of wb.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-12-2013
    Location
    Virginia, USA
    MS-Off Ver
    MSO2010 on Win7
    Posts
    4

    Re: ActiveWorkBook is returning an object with <no variables>

    I got my code working almost as it is, and am commenting here for posterity. I still don't know why I can't see the object in the Watch window. Seems like a bug to me and is rather frustrating. But, I am able to access/store properties and debug.print properties whenever I want.

    The reason the array values were all empty strings was because I was successfully opening my text file, but not with the correct delimiter, so all the Row1 data was in Column1 (instead of Col1, Col2, Col3...) and I was trying to read columns 5 and 6. Once I fixed the delimiter, it read in all the data.

  6. #6
    Registered User
    Join Date
    03-24-2016
    Location
    NYC
    MS-Off Ver
    2007-2016
    Posts
    3

    Re: ActiveWorkBook is returning an object with <no variables>

    I have the exact same problem so i am bumping this old thread for anyone else that stumbles upon it. I haven't truly solved for it but i formulated a workaround. I open the text file, save it as an xlsx, CLOSE it, then immediately re-open and the object then shows all properties and such in the Watches windows. But during this experiment, I discovered that the object was always created even though it wasn't showing up in the Watches window. So i removed the close and reopen code and will ignore this silly bug going forward.

+ 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. ActiveWorkbook.Worksheets.Name - Apllication-defined or object-defined error
    By CLIOWIWI in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-17-2013, 11:19 AM
  2. Help need on returning data with three variables
    By mboyce82 in forum Excel General
    Replies: 6
    Last Post: 05-09-2012, 02:42 PM
  3. ActiveWorkbook.ReadOnly Object Variable error
    By calebfulks in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-12-2011, 03:00 PM
  4. Object variables
    By jbmerrel in forum Excel General
    Replies: 3
    Last Post: 12-08-2011, 11:10 AM
  5. Different between ActiveWorkbook.Sheet and ActiveWorkbook.WorkSheets
    By Ranjani in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-02-2009, 12:56 AM

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