• WSJanB

    WSJanB

    @wsjanb

    Viewing 15 replies - 646 through 660 (of 666 total)
    Author
    Replies
    • in reply to: AutoExec (Word 2003) #765996

      (Edited by HansV to correct typo in first path and to generalize second path)

      > Jan – It didn’t work in Word 2003 but worked fine on an earlier version of Word.

      I use Windows XP Pro and Office 2003, both Dutch versions, and my solution works fine on my PC.
      I did a little testing and found out that there are 2 Startup directories:
      1. C:Program FilesMicrosoft Office 2003OFFICE11STARTUP
      2. C:Documents and SettingsApplication DataMicrosoftWordSTARTUP

      If the add-in containing module AutoExec with Sub Main is placed in 1 (and Options | File locations is pointing to it) then all works fine, no questions asked. This is the path I actually use. But if I place the add-in in 2 and change Options | File locations to that directory, I get a dialog panel asking if I want the macro’s to run or not. Macro security is normally set to Average on my PC. And if I place the add-in in 1 and Options | File locations points to 2, then I also get the macro security dialog panel. And after granting permission, the code in Sub Main runs…!

      So if your add-in is located in 2, you can give relocating it to 1 a try.

      Good luck
      Jan

    • in reply to: AutoExec (Word 2003) #765997

      (Edited by HansV to correct typo in first path and to generalize second path)

      > Jan – It didn’t work in Word 2003 but worked fine on an earlier version of Word.

      I use Windows XP Pro and Office 2003, both Dutch versions, and my solution works fine on my PC.
      I did a little testing and found out that there are 2 Startup directories:
      1. C:Program FilesMicrosoft Office 2003OFFICE11STARTUP
      2. C:Documents and SettingsApplication DataMicrosoftWordSTARTUP

      If the add-in containing module AutoExec with Sub Main is placed in 1 (and Options | File locations is pointing to it) then all works fine, no questions asked. This is the path I actually use. But if I place the add-in in 2 and change Options | File locations to that directory, I get a dialog panel asking if I want the macro’s to run or not. Macro security is normally set to Average on my PC. And if I place the add-in in 1 and Options | File locations points to 2, then I also get the macro security dialog panel. And after granting permission, the code in Sub Main runs…!

      So if your add-in is located in 2, you can give relocating it to 1 a try.

      Good luck
      Jan

    • in reply to: Tall drop-down lists (Office97) #765981

      > Determine the height of the screen. (Can you do that?)

      Determining the width and height of the screen in pixels, using VBA (Word):
      System.HorizontalResolution
      System.VerticalResolution

      Jan

    • in reply to: Tall drop-down lists (Office97) #765982

      > Determine the height of the screen. (Can you do that?)

      Determining the width and height of the screen in pixels, using VBA (Word):
      System.HorizontalResolution
      System.VerticalResolution

      Jan

    • in reply to: Command Button to Unprotect Document (Word 97) #765495

      Kerry,

      If you want to do it in VBA code, and want the buttons to be available in all documents, you can create a global template stored in the Word startup directory, containing the following two little Sub’s:

      Public Sub ProtectionOff()
      With ActiveDocument.
      If .ProtectionType wdNo Protection Then
      .Unprotect Password:=”password” ‘you can omit this if no password is required
      End If
      End With
      End Sub

      Public Sub ProtectionOn
      With ActiveDocument
      If .ProtectionType = wdNoProtection Then
      .Protect Password:=”password” ‘add NoReset:=True, Type:=wdAllowOnlyFormFields if docs contain FormFields
      End If
      End With
      End Sub

      Create a toolbar with two buttons that call the above Subs.

      Jan

    • in reply to: Hidden variables in Excel (Excel 97) #765411

      Another approach could be to use a CustomDocumentProperty instead to store values that you need to retrieve later.

      Regards,
      Jan

    • in reply to: Hidden variables in Excel (Excel 97) #765412

      Another approach could be to use a CustomDocumentProperty instead to store values that you need to retrieve later.

      Regards,
      Jan

    • in reply to: AutoExec (Word 2003) #765403

      Gwenda,

      I use a slightly different approach and that works fine on all versions of Word from 97 up.
      – Create a module with the name AutoExec
      – In that module create a Public Sub Main() which contains all the code you want to run at Word startup.

      Regards,
      Jan

    • in reply to: AutoExec (Word 2003) #765404

      Gwenda,

      I use a slightly different approach and that works fine on all versions of Word from 97 up.
      – Create a module with the name AutoExec
      – In that module create a Public Sub Main() which contains all the code you want to run at Word startup.

      Regards,
      Jan

    • in reply to: Width of a table (Word 2000) #760859

      You can calculate the sum of the widths of all columnsin Table(1) and again for Table(2). If both values are not the same, you can adjust the width of one or more columns in Table(2).

    • in reply to: Width of a table (Word 2000) #760860

      You can calculate the sum of the widths of all columnsin Table(1) and again for Table(2). If both values are not the same, you can adjust the width of one or more columns in Table(2).

    • in reply to: runtime error 5981 (97 SR-1) #759545

      I encountered the same error when opening a file with a (ore more) Sub/Function with the same name as a Sub/Function in a add-in. Temporarily de-installing the add-in and renaming the offending Sub/Function cured the problem.

      Jan

    • in reply to: runtime error 5981 (97 SR-1) #759546

      I encountered the same error when opening a file with a (ore more) Sub/Function with the same name as a Sub/Function in a add-in. Temporarily de-installing the add-in and renaming the offending Sub/Function cured the problem.

      Jan

    • in reply to: using multiple open documents (Word97/2000) #759181

      I don’t know why the described problem occurrs, unless Table(1) is not within the specified bookmaark range.
      In the past I had some trouble with bookmarks (not) containing text too and I found out that another approach worked better.
      Leave at least 1 blank line before and after the table. Insert a bookmark “First” in the blank line before the table and a bookmark “Last” in the blank line after the table. Now try this code:

      Sub Test
      Dim rngBlock As Range
      With ActiveDocument
      Set rngBlock = .Range(.Bookmarks(“First”).Range.End + 1, _
      .Bookmarks(“Last”).Range.Start)
      rngBlock.Select
      End With
      End Sub

      Hope this helpes.
      Jan

    • in reply to: using multiple open documents (Word97/2000) #759182

      I don’t know why the described problem occurrs, unless Table(1) is not within the specified bookmaark range.
      In the past I had some trouble with bookmarks (not) containing text too and I found out that another approach worked better.
      Leave at least 1 blank line before and after the table. Insert a bookmark “First” in the blank line before the table and a bookmark “Last” in the blank line after the table. Now try this code:

      Sub Test
      Dim rngBlock As Range
      With ActiveDocument
      Set rngBlock = .Range(.Bookmarks(“First”).Range.End + 1, _
      .Bookmarks(“Last”).Range.Start)
      rngBlock.Select
      End With
      End Sub

      Hope this helpes.
      Jan

    Viewing 15 replies - 646 through 660 (of 666 total)