Results 1 to 4 of 4
  1. #1
    Lounger
    Join Date
    Apr 2002
    Location
    Sydney, Australia
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Running code instead of Word function (Word 2007)

    Hi

    I have quite a lot of vba code that runs when a particular word function is executed. I do this by creating a procedure using the same name as the word function. For example - code to run when a user presses print will be in a sub routine called FilePrint.

    This code no longer executes in Word 2007. How can I get this functionality working?

    Thanks,

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Running code instead of Word function (Word 20

    If I create a sub called FilePrint then this runs as expected on my Word 2007 machine.

    What exactly does your user do to print the file? Can you record that action to find out what Word has captured?
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. #3
    Lounger
    Join Date
    Apr 2002
    Location
    Sydney, Australia
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Running code instead of Word function (Word 20

    Hi Andrew

    We have Filesite integration that we are trying to get up and running in Word 2007. Here is the code. I am trying to get it running for the FileSave routine. Of course, I will need to amend the "Application.CommandBars("File").Controls("Sav e As...").Execute" line as well. But I can't even get Word to launch this routine at all.

    Public Sub FileSave()
    'Macro to replace Save
    On Error GoTo ErrorHandler

    Dim sect As Section
    Dim ftr As HeaderFooter

    If Documents.Count = 0 Then Exit Sub

    If IsIManageDocument = True Then
    'Already an iManage document, just save it
    ActiveDocument.Save
    Else
    On Error Resume Next
    'Not an iManage document, call the Word 'Save As'
    Application.CommandBars("File").Controls("Save As...").Execute
    On Error GoTo ErrorHandler

    'Update all footers so the document number will be shown
    On Error Resume Next

    For Each sect In ActiveDocument.Sections
    For Each ftr In sect.Footers
    If ftr.Exists Then
    ftr.Range.Fields.Update
    End If
    Next ftr
    Next sect
    End If

    Exit Sub
    ErrorHandler:
    MsgBox "Error in FileSave: " & Err.Description, vbCritical

    End Sub


    Hope you can help.
    Cathy

  4. #4
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Running code instead of Word function (Word 20

    I would guess that Filesite is a document management system and hence it may also have a FileSave routine built into it and perhaps it is getting priority. Can you have a look at the available macros to see if there are two FileSave's listed. Your original question was on FilePrint - does this get managed by Filesite too?

    Is it possible to disable the Filesite addins to see whether you regain the expected behaviour?
    Andrew Lockton, Chrysalis Design, Melbourne Australia

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •