• WSJanB

    WSJanB

    @wsjanb

    Viewing 15 replies - 586 through 600 (of 666 total)
    Author
    Replies
    • in reply to: Invisible printing – shows in print preview (XP) #804732

      I don’t know is this is related to your problem, but today one of our users converted a Word 97 document to PDF (with Adobe’s PDF Writer) and found out that about half a page of text was missing. After taking a close look, I discovered that the problem was caused by unprintable characters used as bullets in a 4-paragraph part of the document. Correcting this solved her problem.

    • in reply to: Formatting of Pasted Text (Word 2000) #804546

      Hi Stuart,

      I don’t agree, because when nothing is copied into the doc and no error message is shown, the user will tend to call the help desk…
      So you have to cater for that. The reason I didn’t include that in my previous post is, that all my messages are in Dutch and I had not much time to spent translating. So here comes the complete code:

      Public Sub PastePlainText

      On Error Goto Error_Handler

      If Documents.Count > 0 then
      Selection.PasteSpecial DataType:=wdPasteText
      End If

      Exit_Error:
      Exit Sub

      Error_Handler:
      Select Case Err.Number
      Case 4605
      MsgBox “There’s nothing on the Clipboard…”, vbInformation + vbOKOnly
      Case 4198, 5342
      MsgBox “The contents of the Clipboard cannot be pasted as plain text.”, vbInformation + vbOkOnly
      Case Else
      MsgBox “Error : ” & Err.Number & vbCrLf & “Description: ” & Err.Description, vbInformation + vbOkOnly, “PastePlainText”
      End Select
      Resume Exit_Error
      End Sub

      The Exit_Error bit is there to always create a single point of exit for a Sub/Function. On many occasions some code sits between the Exit_Error and Exit Sub lines. E.g. turning on document protection if that was turned off earlier in that Sub, to avoid problems with documents containing FormFields.

    • in reply to: DisableFeature and Tracked Changes (97/XP) #804542

      Thanks Jefferson!

    • in reply to: DisableFeature and Tracked Changes (97/XP) #804543

      Thanks Jefferson!

    • in reply to: Protecting text in a Word Document (Word 2000/SP 2) #803822

      You could “hijack” all the disabled menu-entries in a protected form, by writing macro’s with the exact same name as the built-in Word commands. Word then executes your macro instead of the built-in command. In these macro’s you can use the standard Word dialogs. It’s laborious, but it works. Example:

      Public Sub FilePrint()
      If Documents.Count > 0 Then ‘Sub generates error if no doc exists
      Dialogs(wdDialogFilePrint).Show
      End If
      End Sub

      In Word XP / 2003 you also could use a different approach, with the WindowSelectionChange event (see post 342898 from HansV). I’m not sure whether or not that event is available in Word 2000.

    • in reply to: Protecting text in a Word Document (Word 2000/SP 2) #803823

      You could “hijack” all the disabled menu-entries in a protected form, by writing macro’s with the exact same name as the built-in Word commands. Word then executes your macro instead of the built-in command. In these macro’s you can use the standard Word dialogs. It’s laborious, but it works. Example:

      Public Sub FilePrint()
      If Documents.Count > 0 Then ‘Sub generates error if no doc exists
      Dialogs(wdDialogFilePrint).Show
      End If
      End Sub

      In Word XP / 2003 you also could use a different approach, with the WindowSelectionChange event (see post 342898 from HansV). I’m not sure whether or not that event is available in Word 2000.

    • in reply to: DisableFeature and Tracked Changes (97/XP) #803802

      > “find the best way to determine if a table contains a nested table”

      I’m very interested too. In Word 2003 I nested table(2) into table(1) and ActiveDocument.Tables.Count produced just 1 !
      So using a For Each loop through the tables won’t work.

    • in reply to: DisableFeature and Tracked Changes (97/XP) #803803

      > “find the best way to determine if a table contains a nested table”

      I’m very interested too. In Word 2003 I nested table(2) into table(1) and ActiveDocument.Tables.Count produced just 1 !
      So using a For Each loop through the tables won’t work.

    • in reply to: Formatting of Pasted Text (Word 2000) #803360

      I use a simple macro for that purpose too:

      Sub PastePlainText
      If Documents.Count > 0 Then
      Selection.PasteSpecial DataType:=wdPasteText
      End If
      End Sub

      I assigned Alt+V to this macro in order to preserve the normal use of Ctrl+V.

    • in reply to: Formatting of Pasted Text (Word 2000) #803361

      I use a simple macro for that purpose too:

      Sub PastePlainText
      If Documents.Count > 0 Then
      Selection.PasteSpecial DataType:=wdPasteText
      End If
      End Sub

      I assigned Alt+V to this macro in order to preserve the normal use of Ctrl+V.

    • in reply to: Form fields that calculate (2002) #803352

      Hi Macropod,

      I think too that this is a very nice piece of work. clapping
      Provided your Windows is configured to use “,” for grouping on thousands and “.” for decimals, that is. But in Holland it’s the other way around, so I get syntax errors all over the place in my Dutch version of Word 2003. weep
      Is there a simpel way to make the formulae behave correctly indepent of this Windows configuration? Or is that only possible by replacing every “,” with “.” an vice versa?

    • in reply to: Form fields that calculate (2002) #803353

      Hi Macropod,

      I think too that this is a very nice piece of work. clapping
      Provided your Windows is configured to use “,” for grouping on thousands and “.” for decimals, that is. But in Holland it’s the other way around, so I get syntax errors all over the place in my Dutch version of Word 2003. weep
      Is there a simpel way to make the formulae behave correctly indepent of this Windows configuration? Or is that only possible by replacing every “,” with “.” an vice versa?

    • in reply to: Filling FormFields via Macro (Word 2000) #801413

      There’s another workaround that works fine in Word 97, XP and 2003 (don’t have 2000):

      ActiveDocument.Bookmarks(“TxtTarget”).Range.Fields(1).Result.Text = “Here comes the text.”

      Sometimes you cannot select the formfield with ActiveDocument.FormFields(“TxtTarget”).Select.
      If the formfield is of Type wdFieldFormTextInput then this always does the trick:

      ActiveDocument.Bookmarks(“TxtTarget”).Range.Fields(1).Result.Select

      I found this workarounds once on the mvps site .

      To make these work nice, I’ve put them in “wrappers”

      Public Sub SetValueFF(vName As Variant, sValue As String)
      If ActiveDocument.Bookmarks.Exists(vName) Then
      ActiveDocument.Bookmarks(vName).Range.Fields(1).Result.Text = sValue
      End If
      End Sub

      Public Sub SelectFF(vName As Variant)
      With ActiveDocument
      If .Bookmarks.Exists(vName) Then
      If .FormFields(vName).Type = wdFieldFormTextInput Then
      .Bookmarks(vName).Range.Fields(1).Result.Select
      Else
      .FormFields(vName).Select
      End If
      End If
      End With
      End Sub

      Regards
      JanB Netherlands

    • in reply to: Filling FormFields via Macro (Word 2000) #801412

      There’s another workaround that works fine in Word 97, XP and 2003 (don’t have 2000):

      ActiveDocument.Bookmarks(“TxtTarget”).Range.Fields(1).Result.Text = “Here comes the text.”

      Sometimes you cannot select the formfield with ActiveDocument.FormFields(“TxtTarget”).Select.
      If the formfield is of Type wdFieldFormTextInput then this always does the trick:

      ActiveDocument.Bookmarks(“TxtTarget”).Range.Fields(1).Result.Select

      I found this workarounds once on the mvps site .

      To make these work nice, I’ve put them in “wrappers”

      Public Sub SetValueFF(vName As Variant, sValue As String)
      If ActiveDocument.Bookmarks.Exists(vName) Then
      ActiveDocument.Bookmarks(vName).Range.Fields(1).Result.Text = sValue
      End If
      End Sub

      Public Sub SelectFF(vName As Variant)
      With ActiveDocument
      If .Bookmarks.Exists(vName) Then
      If .FormFields(vName).Type = wdFieldFormTextInput Then
      .Bookmarks(vName).Range.Fields(1).Result.Select
      Else
      .FormFields(vName).Select
      End If
      End If
      End With
      End Sub

      Regards
      JanB Netherlands

    • 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

    Viewing 15 replies - 586 through 600 (of 666 total)