Word 2010 broken with latest version of the Word plugin

Hi,

I've been using Zotero 2.0 beta with Word 2010 without any issues until today when Zotero in Word informed me that I needed to update my version of the Word plug-in. However, the new version throws a "The macro cannot be found or has been disabled because of your security settings" when I click on the "insert citation" button. It's in a trusted location so it is not my security settings. I tried running the macro directly and I got the error "Compile error in hidden module: Zotero" which probably explains the first one.

I know Word 2010 is still in beta, so you're not really obliged to support it, but, still it would be nice if it did work (as it did until today).

Thanks in advance,

Tom
«1
  • OK I moved to the Trunk XPI and edited the start of the code to read (changes in bold):

    Type COPYDATASTRUCT
    dwData As Long
    cbData As Long
    lpData As LongPtr
    End Type

    Private Const WM_COPYDATA = &H4A
    Private Declare PtrSafe Function FindWindow Lib "user32" Alias _
    "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName _
    As String) As Long
    Private Declare PtrSafe Function SendMessage Lib "user32" Alias _
    "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal _
    wParam As Long, lParam As Any) As Integer
    Private Declare PtrSafe Function SetForegroundWindow Lib "user32" _
    (ByVal hwnd As Long) As Long
    Private Declare PtrSafe Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
    (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)
    and it does at least now compile, though calling the various macros doesn't seem to do anything now so it's far from working.
  • (If it wasn't clear this is x64 Word 2010, hence the need for LongPtr's (though on 32-bit systems LongPtr is 32 bit.)

    I presume the Zotero client is not expecting to get sent a 64 bit pointer and that's what's causing it not to do anything.
  • OK I hacked in a work-around, by adding:
    Shell ("c:\Program Files (x86)\Mozilla Firefox\" & a$)
    to the end of the function.

    I presume this is how it used to work before.
  • edited December 21, 2009
    Any chance that you have an installable version of this? I am getting the exact same error message, but am not savvy enough to play around with the code/xpi. Using x64 version on windows vista.

    if you can't see my email in my profile - mattyp@ksu.edu

    If you can send me your version of the template, I can install it.

    Thanks!
  • Hello,

    i got exact the same problem, runnig WIN7x64 and Word 2010x64.
    Would be great, if you can send me the template (uni(at)centner.net) .

    Thanks al lot

    Regards
  • Hello,

    it is working now.

    The modificated code is (thanks cpf):

    Option Explicit

    Type COPYDATASTRUCT
    dwData As Long
    cbData As Long
    lpData As LongPtr
    End Type

    Private Const WM_COPYDATA = &H4A
    Private Declare PtrSafe Function FindWindow Lib "user32" Alias _
    "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName _
    As String) As Long
    Private Declare PtrSafe Function SendMessage Lib "user32" Alias _
    "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal _
    wParam As Long, lParam As Any) As Integer
    Private Declare PtrSafe Function SetForegroundWindow Lib "user32" _
    (ByVal hwnd As Long) As Long
    Private Declare PtrSafe Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
    (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)

    Sub ZoteroInsertCitation()
    Call ZoteroCommand("addCitation", True)
    End Sub
    Sub ZoteroInsertBibliography()
    Call ZoteroCommand("addBibliography", False)
    End Sub
    Sub ZoteroEditCitation()
    Call ZoteroCommand("editCitation", True)
    End Sub
    Sub ZoteroEditBibliography()
    Call ZoteroCommand("editBibliography", True)
    End Sub
    Sub ZoteroSetDocPrefs()
    Call ZoteroCommand("setDocPrefs", True)
    End Sub
    Sub ZoteroRefresh()
    Call ZoteroCommand("refresh", False)
    End Sub
    Sub ZoteroRemoveCodes()
    Call ZoteroCommand("removeCodes", False)
    End Sub
    Sub ZoteroCommand(cmd As String, bringToFront As Boolean)
    Dim cds As COPYDATASTRUCT
    Dim ThWnd As Long, pwi As Long
    Dim buf(1 To 255) As Byte
    Dim a$, args$
    Dim i As Long
    Dim ignore As Long

    ' Try various names for Firefox
    Dim appNames(4)
    appNames(1) = "Firefox"
    appNames(2) = "Browser"
    appNames(3) = "Minefield"
    appNames(4) = "Namoroka"
    For i = 1 To 4
    ThWnd = FindWindow(appNames(i) & "MessageWindow", vbNullString)
    If ThWnd <> 0 Then
    Exit For
    End If
    Next
    If ThWnd = 0 Then
    MsgBox ("Word could not communicate with Zotero. Please ensure Firefox is running and try again.")
    Exit Sub
    End If

    ' Allow Firefox to bring a window to the front
    If bringToFront Then Call SetForegroundWindow(ThWnd)
    ' Set command line arguments
    args$ = "-silent -ZoteroIntegrationAgent WinWord -ZoteroIntegrationCommand " & cmd
    a$ = "firefox.exe " & args$ & Chr$(0) & "C:\"
    Call CopyMemory(buf(1), ByVal a$, Len(a$))
    cds.dwData = 1
    cds.cbData = Len(a$) + 1
    cds.lpData = VarPtr(buf(1))
    i = SendMessage(ThWnd, WM_COPYDATA, 0, cds)
    If Err.LastDllError = 5 Then
    If Dir("C:\Program Files\Mozilla Firefox\firefox.exe") <> "" Then
    Call Shell("""C:\Program Files\Mozilla Firefox\firefox.exe"" " & args$, vbNormalFocus)
    ElseIf Dir("C:\Program Files (x86)\Mozilla Firefox\firefox.exe") <> "" Then
    Call Shell("""C:\Program Files (x86)\Mozilla Firefox\firefox.exe"" " & args$, vbNormalFocus)
    End If
    End If

    Shell ("C:\Program Files (x86)\Mozilla Firefox\" & a$)
    End Sub



    Regards
  • Hello,

    I have the exact same problem with W7 x64 and Office x64.

    Could you be kind enough to send me the modified version as well? I am totally unable to customize the extension by myself.

    Thanks a lot

    Loïs

    wamsaya@gmail.com
  • edited January 27, 2010
    hi,

    i too am facing the same problem W7 x64, Word 2010 x64, can you please send me also the modified version?

    regards
    srini

    update: i tried editing on my own.. seems to be working
  • This worked for me. Please note that you may need to manually remove the old version of Zotero.dot before installing the new version.
  • Could someone explain where/how to make these edits? Or post a patch? Or update the install files? I just started trying to use Zotero on 64 bit Windows 7 with 64 bit Office 2010 RC and am having the same problems. I could probably copy and paste this code... if I even knew where to go!
    Thanks for your help,
    Nick
    nfahrenkopf@gmail.com
  • Download the .xpi and rename to .zip. In one of the folders you will find zotero.dot. Edit the macros in this file. Rename the .zip back to .xpi and reinstall. Also, see my note above. It may also be necessary to copy zotero.dot to the Start flder if the install doesn't work properly.
  • I just (re)downloaded the .xpi from the homepage of zotero.org, I renamed it .zip but couldn't find anything named zotero.dot.
  • did you open the zip file?
  • nfahrenkopf: groston is referring to the WinWord plugin XPI, not the main Zotero XPI.
  • The plug-in xpi, not the main xpi
  • OK, thanks. I uninstalled the plug-in. Downloaded it, found the file, opened the macro and copy-pasted the code above from FGUL. I saved the updated .dot file on my desktop, and replaced the one in the zip with the new one. I think changed the .zip back to the .xpi and installed it in FireFox and I get the same error message.
  • Update: I added the new zotero.dot to my Windows startup folder. I restarted my computer and when Word opened I had two rows of buttons- and they work. (Yay!) But when I start a new document, or open an old one there is only one row, and they don't work. Is there some other startup folder I was supposed to put zotero.dot into? I don't need it opening everytime I start the PC, but I would like those buttons to work...
  • You put it in the Word startup folder, not the Windows startup folder.

    http://www.zotero.org/support/windows_word_plugin_manual_installation_instructions
  • After being modified, it works ok now on my pc: win7x64+word2010x64+firefox.v3.6.3.x86+zotero.2.0.2
  • I also attempted this. It took about 2 hrs to figure it out. I'm pretty sure that all one has to do is modify the zotero.dot file, but it's not good enough just to open the file and cut-and-paste. It has to be edited in a macro editor (like the one in MS Word). For some reason, I had to use a 32-bit version of MS Word to do my editing. After all that, I tried it again with the 64-bit version, and it worked. Go figure!) Anyway, here are the steps I used:
    1. Find the zotero.dot file (go to your c:/ drive and search for it, then follow the link. Make sure to edit the file that is in use by MS Word.) Two possible locations:
    - C:\Users\*YOURNAME*\AppData\Roaming\Microsoft\Word\STARTUP\zotero.dot
    - C:\Users\*YOURNAME*\AppData\Roaming\Mozilla\Firefox\Profiles\894umbre.default\
    extensions\zoteroWinWordIntegration@zotero.org\install\zotero.dot
    2. Open "zotero.dot" in MS Word
    3. Enable the "developer" tab (if you have not already done so. Search MS Word Help to get this up.)
    4. In the "Developer" tab, Click "Macros"
    5. Click on "NewMacros.ZoteroInsertCitation" and click on the "Edit" button
    6. A couple of sub-windows open up. You'll be editing the one that says: "Zotero - Zotero (Code)"
    7. Replace the entire contents with the entire contents of the above post.
    8. Click "Save"
  • Now, would someone please tell me why there is not a separate download of the Word For Windows plug-in of the 64-bit version of MS Word? I'm using brand new installs of Word 2010 Student on a stable Windows 7 platform, and both Firefox 3.6.3, Zotero 2.0.3, and the Zotero Word for Windows Plugin 3.0a3 were installed for the first time today, so I'm guessing its not unique to my situation. This is a pretty easy fix once you figure it out, but come on, this is not a Linux user's group.
  • My guess is that the Zotero folks haven't been able to test the patch personally, perhaps because they don't have Word 2010... In any case, you're absolutely correct that a version for the 64-bit version of Word 2010 should be distributed.

    @cfp and @FGUL: Does the modified plugin still work in non-64-bit Word? If not, is it possible to make changes that would let one version of the plugin operate in both 32-bit and 64-bit Word?
  • This is not working for me (I am a user of Windows 7 64 bit, Word 2010 beta 64 bit). I can see buttons in 'Add-Ins' menu, but have got two same errors during processing every macro code.

    "Zotero Integration Error: Zotero experienced an error updating your document"

    Any idea to solve it?

    P.S. I submit an error report (ID: 1526941334) regarding this issue, but am not sure where or how to describe the problem in this forum.
  • I've just tried the fix that DAL (above) listed for Word 2010 beta (PC, Firefox). Zotero works ok in new documents, but not old ones--even old ones in which it worked previously.

    This is getting a little untenable. Word 2010 releases in just a few weeks, and I'd like to be able to use it with Zotero.

    Report ID: 1292628070
  • I'm running Windows 7 Ultimate 64-bit, Word 2010 Professional Plus 64-bit, Zotero Plugin 2.0.3 and Zotero WinWord Integration 3.0a3. FGULs' code (credits to cpf too) from January 12th post worked perfectly for me!

    One point that might help, is once you have loaded the Developer toolbar, you can click on the Document Template icon to see the location of the loaded Zotero.dot template. Mine was C:\Users\MyName\AppData\Roaming\Microsoft\Word\STARTUP.

    If you are having problems with Word showing more than one toolbar, then delete the WinWord integration add-on from Firefox and delete any erroneous Zotero.dot templates. Then start again!
  • This may be of some use for adapting the plugin to be used with both 32bit and 64bit versions of Office 2010 (if indeed there are issues, which I suspect there might be):

    http://msdn.microsoft.com/en-us/library/ff700513%28office.11%29.aspx#odc_dnofftalk_ta_WorkingwithVBA32bit64bitOffice2010_Workingwith32bit64bitOffice2010

    I'll have a look into this and try work up some code, it shouldn't be too hard to modify the existing VBA code with some if... then... else statements here and there!?
  • edited June 12, 2010
    The plug-in has already been patched to support both 32-bit and 64-bit versions of Office, and the changes are available in the trunk WinWord Integration plug-in. It would be great if we could get some users to test this.
  • My copy of Office 2010 Academic Pro is on the way. I'll test and report back once I get it running.
  • I found a file at the following location:

    users\"name"\appdata\roaming\mozilla\firefox\profiles\2u35c9zi.default\extensions\zoterowinwordintegration@zotero.org\install

    when I double-clicked the icon a new MS Word window opened and said "macros disable". I enabled the macros and it worked fine--for just this session. Any ideas on how I might "enable" this file on startup?
  • cooljazz: Does this have something to do with the above? If not, start a new thread.

    And don't double-click the .dot file. Copy it to your Word startup folder, which should be listed in Tools→Templates and Add-ins in Word, if you want/need to install it manually.

    But again, start a new thread if you're having trouble, since this doesn't seem to be related to the above.
Sign In or Register to comment.