• WSJanB

    WSJanB

    @wsjanb

    Viewing 15 replies - 601 through 615 (of 666 total)
    Author
    Replies
    • in reply to: Office97 to 2003 upgrade (Office2003) #801394

      We are upgrading from Office 97 to Office 2003 too. We’ve developed a lot of “intelligent” templates in Word, which are dynamically built based on user choices, in dropdown formfields or with a commandbarbutton. That requires quite some VBA code, put in a single code-template that sits in the Word Startup directory. None of the other templates contains any code at all.

      Loading the code-template in Word 2003 caused only a couple of problems and some minor inconveniences.
      Word 97 VBA only has 1 event on application level that you can use to control opening documents by users: DocumentChange. This event fires whenever user creates or opens a document or changes to another document (menu Window). Loaded in Word 2003 the event-handling Sub wdApp_DocumentChange is run several (up to 32!) times before it triggered the rest of the code. And when you try to create a new document from a template, the event-handler goes into an endless loop… I haven’t found a reason, nor a solution / workaround for this. Apparently this event doesn’t work exactly the same as in Word 97. So I had to convert to 2 events which are not in Word 97 VBA: NewDocument and DocumentOpen. And that worked fine. But it means that I have to maintain 2 versions of my code template until our last user is upgraded to Office 2003.

      The second problem is hijacking menu entries and commandbar buttons the way it was done. If you do that properly (using the same name as the built-in Word command for your Sub) then you don’t have a problem. But unfortunately in the early days we didn’t know that and used dutch names for our own routines. And replaced the standard menu entries and commandbar buttons with ones that pointed to the Sub’s we created. Because the menubar in Word 2003 is organised differently, some entries showed up twice or even three times. So we decided to rename our Sub’s to match the built-in names and restore the original menubar and commandbar Standard.

      Then there is this is strange behaviour of AutoText fragments that are saved with the template and placed in a document by VBA code. These fragments can contain both plain text and formfields. On some (!) PC’s the plain text was in Arial, as intended, but for the formfields the (ugly!) font MS Mincho was used. We can’t figure out why this happens. Eventually we decided to delete this font (present in both Windows XP and Office 2003 CAB files) from all PC’s. After that, Word used Arial Unicode MS for the formfields. But because there’s no visible difference with standard Arial, we can live with that.

      The first mouseclick on a control in a dialog panel didn’t always do what you expect. It looks like the panel you just put on the screen (.Show) didn’t set the focus on the panel and that the first mouseclick just does set the focus on the panel. So you have to click again to fire the code behind the clicked control. We observed this both in Word XP (almost every time) and in Word 2003 (about fifty-fifty) when Windos XP Pro (dutch) and Office XP/2003 Enterprise Edition (dutch)were installed out-of-the-box. After a complete re-install of the PC’s, with all the latest patches for both Windows and Office applied, this problem seems to be solved. We never found out why it occurred in the first place.

      Pagenumbering (page x of y) still is not perfect. At first we removed all code for updating the y-value because we thought that this was – finally – solved in Word XP / 2003. But in some cases we again encounterd document with the 1 of 1, 2 of 1, 3 of 1, etc. numbering. So we put the removed code back in…

      The last issue I’d like to mention is that creating and opening documents takes more time in Word 2003 than it did in Word 97, up to 4x slower. These observations were made on a 2.53 Mhz Pentium 4 with 256 Mb memory and only Windows and Office installed.

      Regards,
      JanB

    • in reply to: creat pdf files (2000) #800324

      Word really doesn’t need pdf995 to mess up pagination… innocent

      Regards
      JanB Netherlands

    • in reply to: creat pdf files (2000) #800325

      Word really doesn’t need pdf995 to mess up pagination… innocent

      Regards
      JanB Netherlands

    • I have quit a few templates with specific commandbars attached, developed in Word 97. These all work as expected in Word 2003. In one template there are 2 items added to the Insert menu and these only show when a document based on that particular template is loaded. So I don’t have the problem you described.

      > To make it appear, I have to go to “Tools… Customize”

      It’s not clear to me if you do that in the document or in the template. It should be done in the template which is then saved again.

      Regards,
      Jan

    • I have quit a few templates with specific commandbars attached, developed in Word 97. These all work as expected in Word 2003. In one template there are 2 items added to the Insert menu and these only show when a document based on that particular template is loaded. So I don’t have the problem you described.

      > To make it appear, I have to go to “Tools… Customize”

      It’s not clear to me if you do that in the document or in the template. It should be done in the template which is then saved again.

      Regards,
      Jan

    • in reply to: Userform – Show contents on reopening document (Word 97) #788684

      Hi Kerry,

      You could create a CustomDocumentProperty (CDP) for each element in the userform and save the content / status of the elements in the appropriate CDP after the user clicks a button on the userform that unloads / hides that form.
      When (re)opening the file and calling the form again you could, in the form_Initialize routine, read the CDPs and populate the elements of the form with the saved content / status. (Of course you have to check first whether or not the CDPs exist.)

      Regards,
      Jan

    • in reply to: Userform – Show contents on reopening document (Word 97) #788685

      Hi Kerry,

      You could create a CustomDocumentProperty (CDP) for each element in the userform and save the content / status of the elements in the appropriate CDP after the user clicks a button on the userform that unloads / hides that form.
      When (re)opening the file and calling the form again you could, in the form_Initialize routine, read the CDPs and populate the elements of the form with the saved content / status. (Of course you have to check first whether or not the CDPs exist.)

      Regards,
      Jan

    • in reply to: Project Protecion (2000/XP) #788613

      If you do something in the code that “changes” (according to Excel) the file with the code, then you get prompted to save that file and therefore the password is needed. You can avoid that by adding a line of code that sets the Saved flag.
      Personally I don’t have much experience with Excel VBA, but I suppose it’s not too different from Word VBA. So depending on the actual situation the line of code can be either:
      ActiveWorkbook.Saved = True
      Workbooks(i).Saved = True (i = indexnumber)
      Workbooks(“name.xls”).Saved = True (replace with actual name of file)
      etc.

      Place this line of code after the code that “changes” the file, or place it in an AutoClose Sub.

      Regards,
      Jan

    • in reply to: Project Protecion (2000/XP) #788614

      If you do something in the code that “changes” (according to Excel) the file with the code, then you get prompted to save that file and therefore the password is needed. You can avoid that by adding a line of code that sets the Saved flag.
      Personally I don’t have much experience with Excel VBA, but I suppose it’s not too different from Word VBA. So depending on the actual situation the line of code can be either:
      ActiveWorkbook.Saved = True
      Workbooks(i).Saved = True (i = indexnumber)
      Workbooks(“name.xls”).Saved = True (replace with actual name of file)
      etc.

      Place this line of code after the code that “changes” the file, or place it in an AutoClose Sub.

      Regards,
      Jan

    • in reply to: using forms (Word 2000) #785734

      Hi Hans, Porley

      I had a wonderful long weekend!
      Thanks Hans, for taking care of this.
      I have one suggestion for the code to be more generic:

      Private Sub app_WindowSelectionChange(ByVal Sel As Selection)
      If Sel.Information(wdActiveEndSectionNumber).ProtectedForForms = True And _
      ActiveDocument.ProtectionType = wdNoProtection Then
      ActiveDocument.Protect NoReset:=True, Type:=wdAllowOnlyFormFields
      ElseIf Sel.Information(wdActiveEndSectionNumber).ProtectedForForms = False And _
      ActiveDocument.ProtectionType = wdAllowOnlyFormFields Then
      ActiveDocument.Unprotect
      End If
      End Sub

      Regards,
      Jan

    • in reply to: using forms (Word 2000) #785735

      Hi Hans, Porley

      I had a wonderful long weekend!
      Thanks Hans, for taking care of this.
      I have one suggestion for the code to be more generic:

      Private Sub app_WindowSelectionChange(ByVal Sel As Selection)
      If Sel.Information(wdActiveEndSectionNumber).ProtectedForForms = True And _
      ActiveDocument.ProtectionType = wdNoProtection Then
      ActiveDocument.Protect NoReset:=True, Type:=wdAllowOnlyFormFields
      ElseIf Sel.Information(wdActiveEndSectionNumber).ProtectedForForms = False And _
      ActiveDocument.ProtectionType = wdAllowOnlyFormFields Then
      ActiveDocument.Unprotect
      End If
      End Sub

      Regards,
      Jan

    • in reply to: using forms (Word 2000) #783293

      Hans, Porley,

      In a few minutes I’m leaving the office and have a very long weekend, returning tuesday or wednesday. If Porley cannot wait that long, and if the article I mentioned in my post 341104 in this thread isn’t clear enough to put things together, I hope Hans can help Porley out this time.

      Regards,
      JanB

    • in reply to: using forms (Word 2000) #783294

      Hans, Porley,

      In a few minutes I’m leaving the office and have a very long weekend, returning tuesday or wednesday. If Porley cannot wait that long, and if the article I mentioned in my post 341104 in this thread isn’t clear enough to put things together, I hope Hans can help Porley out this time.

      Regards,
      JanB

    • in reply to: using forms (Word 2000) #781036

      A good article on document and application events by Bill Coan, Take Control of Microsoft Word Through Events, can be found here.

      JanB

    • in reply to: using forms (Word 2000) #781037

      A good article on document and application events by Bill Coan, Take Control of Microsoft Word Through Events, can be found here.

      JanB

    Viewing 15 replies - 601 through 615 (of 666 total)