Word overflow when inserting bibliography

Hello,

I've got a master document with sub-documents for my thesis and I'm now trying to generate a reference list at the end. However, it's not working. Initially I got a VBA error '91' (with variable not set) -- this turned out to be due to some dodgy characters in a reference (seriously, when checking the db integrity, can't Zotero check for unusual characters?!). Sorted that reference, hit 'Insert bibliography', full of optimism... 'Run time error 6; Overflow'. Booooooooooo.

I can't believe that I have too many references or anything like that. And I have no way of counting how many I do have (Harvard referencing). Buy anyway, it's less than 65536, and I assume that Zotero can count to more than 128?!?!

Any thoughts?
«1
  • See http://forums.zotero.org/discussion/3233/#Item_20 and my second message down from there. It's some sort of VBA limit, not one of Zotero's, but I don't know what exactly it is.

    We'll try to reproduce this and see what's going on here. We've finished completely rewritten Python-based versions of the OpenOffice and Mac Word plugins, which certainly avoid VBA issues like this, and we're doing some final testing of those. They may be ported to Word for Windows if issues like this prove too annoying to fix.
  • edited September 18, 2008
    Dan,

    Thanks for this. I'm not quite sure what you're suggesting as a fix though?!

    I know you'll be reluctant to do so, but can you be any more specific about when the Python version of the plugin is coming out? (I'm happy to beta-test it on my Mac if there's a chance it'll sort the problem!!) Or should I break the document in two, compile two separate reference lists and then merge them together?

    In case it helps, the document is...
    212 pages (w/o the bibliography!)
    42,812 words
    276,469 characters (inc. spaces)

    PS: Is this a Windows problem or a general Word problem? Is it worth trying on Mac Office 2004?
  • Me too... so to speak. I've just spent days converting my half finished thesis from EndNote to Zotero, and when I go to insert the bibliography (approximate 300 entries) I get the VB run-time error '6' message.

    I was feeling pretty smug about the conversion until I got this error.

    Unlike mastuff, I only have one document (not a maser/sub-document arrangement).

    I'm using Office 2007, FireFox 3. There seem to be no errors in the database.

    My conversion process is now stalled as I need to check my old bibilography against the (non-existant) new one (to see if I made any errors).

    Would you like a copy of the file and the zotero database?
  • Interesting ... I have the impression that the problem occurs around the 212-225 bibliographic entries (and definitely below 256).

    This is a bit of show stopper.
  • edited September 19, 2008
    EDIT: I've sorted an actual proper fix underneath this, but that involves changing Zotero directly. If you're not happy with doing that (it's honestly not that hard!) then do this instead...

    I've not got around to testing this yet, but I'm going to try the following (I'm 95% confident (!) it'll work...)

    1. Finish document *completely* (this is not a dynamic work-around, i.e. should it work, the bibliography won't be able to be updated if citations are added / removed)
    2. Copy half the document into a new document; generate bibliography
    3. Copy bibliography into text editor, either Notepad or Write (probably Write as it'll preserve formatting)
    4. Repeat with other half of document -- append the second half of the bibliography to the first half
    5. Copy the whole bibliography back into an empty Word document, select it all and sort it (Table -> Sort)
    6. Chuck it back into the thesis
    7. Make a brew

    I imagine that'll work, but it's a bit of a faff. I had a dodgy reference in there originally so had to do the whole, split-the-document-in-half-repeatedly-whilst-trying-to-generate-bibliography faff, to isolate that. It was literally one citation, and isolating the half without that citation allowed me to generate the bibliography. The text needs to be copied out of Word as otherwise Word will keep it as fields, which it won't sort, which isn't helpful.

    This error is obviously being thrown by the VBA script, which I can't see, but it'd be good to know whether just changing the data type of whichever variable is responsible made a difference? Surely it can't be that tricky to change something from an integer to a double, or whatever?! Although, having read one of Dan's other posts he seemed to imply that it was a problem with the total length of the document, but that seems unlikely, unless the problem is that a string in the macro is being filled; strings have a size limit of 65,280 characters (see link below), but if that was exceeded I'm not sure it would throw an overflow error, more likely an 'out of string space'!

    http://support.microsoft.com/default.aspx?scid=kb;en-us;Q211489

    Is there any way of viewing / changing the VBA code?
  • edited September 19, 2008
    WOOHOO!!!

    Ok, sorted. I opened Zotero.dot and had a look directly at the VBA.

    It is a Zotero error.

    There are two variables declared as integers, when they should be long ints -- they are mTagStart and mTagEnd and they're declared at the top of 'subInsertFormattedText'. Just change the word 'Integer' to 'Long' after each of these and it's sorted.

    I'm back in love with Zotero :)
  • Hi,

    I'm having a similar problem with the "run-time error '6'... overflow" message. Could someone explain what VBA is -- and what application to use to open the Zotero.dot file?

    I tried to open this file (icon looks like a word document) but it is completely blank.

    Is the fix described above by matstuff completely safe?

    Thanks,
    SR
  • Thanks for tracking this down. Apparently integers in VBA are limited to only 32K, whereas longs are 2 billion. (For strings, by the way, this page says that only fixed-length strings are limited to 65K, and that dynamic strings are 2 billion—not sure if that's the case.)

    We've made this change in SVN, and it'll be included in the new VBA version we release along with the Python versions in the near future.
  • Patching the code worked wonders for me. Thanks matstuff
  • edited September 29, 2008
    skr8,

    Vba is visual basic for applications and is a programming language by microsoft that allows you to automate programs in their office suite.

    Patching the code is, basically, safe. Anyway, just take a copy of zotero.dot before you start playing! Step by step instructions follow...

    1. Shut down all instances of Word. Find zotero.dot and right click on it; choose open (default is 'New').

    2. You should be faced with a blank document. Press Alt+F11 and the vba editor will appear. On the left is a component tree (?!). Expand the 'modules' node and double click on zotero.bas. A world of gobbledegook will appear in the editor to the right.

    3. Click in the code and hit CTRL+F. Type in 'mTagStart' and press Find. You'll see a line of code something like 'Dim mTagStart as Integer'. Replace the word integer with 'long'. If everything's fine the 'long' will be capitalized and turn blue when you move the cursor to another line (do NOT press enter!)

    4. Repeat step 3 with mTagEnd.

    5. Save (CTRL+S) and quit the vba editor and Word. All done!

    If anything goes wrong or you get an unexpected message just quit without saving.

    Good luck. If that's not completely clear (!) let me know.

    Mat
  • Am having the same problem with Word adding refs slowly until I hit about 160 refs, then it started giving me the "run time error 6" error message. I tried the fix mentioned above to zotero.dot, but can't get past the modules branch. There is not zotero.bas that I can see to click on. Any other ideas?
  • Erm... Are you sure you're opening Zotero.dot correctly? Do NOT just double-click on it, that won't work. You *must* right-click and then select 'Open'.

    I was doing that fix from memory without checking as I went along. It's actually just 'Zotero', not 'Zotero.bas'. If you've opened Zotero.dot correctly it will definitely be there. To be more explicit on the tree, it goes...

    Project (Zotero) > Modules > Zotero

    If that's still not working, try my other fix...
  • mat,

    I think its mTagStart and mTagEnd instead.

    Great stuff, it worked for me too.
  • Same problem, same solution. Thank you. Oh, and I can confirm it's mTagStart and mTagEnd.
  • Cheers for the clarification guys. I've changed the instructions to reflect it. Glad it's working for you :)
  • I understand the "zotero.dot" fix is for OO in Windows. Is there a fix for Linux?

    I have an overflow problem in OO2.4 and OO3 in Ubuntu 8.04. Although I deleted bibliography for now, the overflow problem is still there.
  • ela
    edited February 20, 2009
    Hi, please help me.

    Windows XP. There is no zotero.dot file!!!!

    I have in 2 weeks my thesis deadline!!!

    I have the newest OOffice version and firefox/zotero too.
    where I can fix this otherwise from integer to long??

    thx in advance
    ela

    I have done the steps with "Alt+F11" and now I have another bad bug

    see image
    http://img502.imageshack.us/img502/3060/zoterooverflowafterchanbq2.gif


    Update:

    I changed all integers from subInsertFormattedText snd the calling subroutines to Long

    1. error like above in the picture, but befor OO was broken and I have to restore the used files - bad
    2. The bibliography is updated
    3. the worst case is now a little bit smaller
    4. changing Falso to True hadn't any effect
    But here I cannot deal with that, any suggestion
    update:
    6. This happens only when the first new reference is inserted into my OOffice document.


    cheers
    ela
  • The fix using the conversion from integer to long worked for me with Word 2007. Cheers to collaborative problem solving!!!
  • Hi,

    the problem described above after the conversion procedures are gone!
    As I restarted my machine two days ago I think this has cleaned all the caches from firefox and Openoffice (I remove all temporary files during logging of from windows) and now I don't observe any problem while inserting or updating anq citation. :)
  • Using XP with Word 2003,
    Same problem, same solution.
    Fixing the zotero.dot file (both mTagStart and mTagEnd) did the trick.

    Thank you all.
  • Kinda funny that so few people have this problem.
    A big thank you to Matstuff for coming up with this solution
  • Unfortunately i am back! i had overcome the above issue when my bibliography got into the 300s but now even though i have changed the integer to long in both instances i still get the Runtime error '6': Overflow message. The bibliography function works in documents with smaller amounts of citations. My thesis does have about 450 citations total. Is that just too much or is there some other way around this? Thanks for any help you can provide. Time is of the essence... marc
  • Marc,

    Bad luck! I wonder what Zotero is doing with such big numbers...? Anyway, keep on going, and try a data-type with more capacity than 'Long', namely 'Double'. Same solution, but use the word 'Double' in place of 'Integer' or 'Long'

    ('Long' will store up to 2,147,486,647, 'Double' will go to 1.79769313486232x10^308; basically, if you fill up a 'Double' I'll be dead impressed! Double's are there to store decimal information, but there's no reason they can't hold integers, so it *should* work!)

    Good luck.

    Mat
  • It doesn't work for me... I tried all the solutions from here (Long, Double...) and my bibliography stop at 184 entries...
    Any other idea? thanks!
  • I just ran into this problem with word 2004, zotero 1.0.10 on osx 10.5.8. the fix suggested by matstuff worked fine - thx for that.

    but I am wondering that this still persist in 1.0.10. any chance it will be fixed in 1.0.11?!
  • There won't be a 1.0.11, but this is already fixed in the 2.0 betas.
  • unfortunate as I (and a couple of colleagues) took office 2008 and zotero 2.0 for a testdrive and decided to stick with the older versions. its more stable imho and 2008 is so damm slow even after all the upgrades.
  • ups - sorry - didn't realize that word 2004 now is supported for zotero 2.0! most excellent!

    thx!
  • Hello and thank you everyone for these answers.

    I am having the same problem and I must run the risk of having everybody scoff at me by asking: how and where exactly can I find Zotero.dot?

    I don't know anything about Visual Basic but read about it and managed to get in, only it says the Zotero project is inaccessible.

    Any help will be very much appreciated. Thank you very much!
  • edited February 16, 2010
    A .dot file is a template for Word (old Word actually, now they are .dotx). Try documents and settings -> [Your Name] -> Application Data -> Microsoft -> Word. (Not sure why it is not in the addins folder).

    Edit: Sorry it's actually in a subfolder there, "startup" (at least for me).
Sign In or Register to comment.