From: "Tony Jollans" My forename at my surname dot on 29 Apr 2007 18:59 Thank you Lene. I did look at a few options to see if any might affect it but didn't try that one. > In general, my experience is the all options with the word "smart" in > their > names are causing more trouble than most other options LOL! Sounds like a good thing to assume! -- Enjoy, Tony Jollans Microsoft Word MVP "Lene Fredborg" <lf(a)REMOVETHISthedoctools.com> wrote in message news:D2DF0AD5-04F1-4F8B-94ED-6EBA7EEDD784(a)microsoft.com... >I tested the macro yesterday and found that it always deleted the text > (regardless of ! etc.). However, I now remember that I have previously > experienced related problems with spaces being inserted and deletion not > working. I then found that the problems were caused by the "Smart cut and > paste" option in Tools > Options > Edit tab being _turned on_. As soon as > that option was turned off, everything worked as expected. Normally, I > have > the "Smart cut and paste" option turned off because of such problems. I > just > tested the macro again with "Smart cut and paste" _turned on_ and the > problem > described by the OP appeared. > > In VBA, I have previously handled the problem by turning off "Smart cut > and > paste" before executing operations that could else fail. I have saved the > user's original setting of the option and reapplied it afterwards. The > code > lines for this could be: > > Before the operation: > Dim OrigSmartCutAndPaste As Boolean > Options.SmartCutPaste = False > > After the operation: > Options.SmartCutPaste = OrigSmartCutAndPaste > > NOTE: I have found that there are two properties that can be used to turn > off the "Smart cut and paste" option: "SmartCutPaste" and > "PasteSmartCutPaste". I have used "SmartCutPaste" because I found that > "PasteSmartCutPaste" does not exist in Word 2000 (and earlier I think). > > In general, my experience is the all options with the word "smart" in > their > names are causing more trouble than most other options - not least in > relation to VBA (which I do not find smart.) . > > -- > Regards > Lene Fredborg > DocTools - Denmark > www.thedoctools.com > Document automation - add-ins, macros and templates for Microsoft Word > > > "mccaskey" wrote: > >> This is too weird. >> >> Open a new word document. Enter a few characters. >> >> Open VB and enter this subroutine: >> >> Sub deleteChar() >> Dim a as Range >> Set a = ActiveDocument.Range(Start:=1, End:=2) >> a.Delete >> End Sub >> >> Run the routine. As expected, the second character of your string will >> be deleted . . . >> >> .. . . unless the first character is ! and the second is a space, in >> which case nothing happens. >> >> If the first character is ! and the second is not a space, the routine >> will replace your second character with a space. >> >> The same happens if the first character is a right double quotation >> mark (Alt + 0148). >> >> What's going on? >> >> Can anyone else reproduce this? I've tried it with two releases of >> Word 2003. >> >>
From: Jean-Guy Marcil on 29 Apr 2007 21:36
Lene Fredborg was telling us: Lene Fredborg nous racontait que : > I tested the macro yesterday and found that it always deleted the text > (regardless of ! etc.). However, I now remember that I have previously > experienced related problems with spaces being inserted and deletion > not working. I then found that the problems were caused by the "Smart > cut and paste" option in Tools > Options > Edit tab being _turned > on_. As soon as that option was turned off, everything worked as > expected. Normally, I have the "Smart cut and paste" option turned > off because of such problems. I just tested the macro again with > "Smart cut and paste" _turned on_ and the problem described by the OP > appeared. > > In VBA, I have previously handled the problem by turning off "Smart > cut and paste" before executing operations that could else fail. I > have saved the user's original setting of the option and reapplied it > afterwards. The code lines for this could be: > > Before the operation: > Dim OrigSmartCutAndPaste As Boolean > Options.SmartCutPaste = False > > After the operation: > Options.SmartCutPaste = OrigSmartCutAndPaste > > NOTE: I have found that there are two properties that can be used to > turn off the "Smart cut and paste" option: "SmartCutPaste" and > "PasteSmartCutPaste". I have used "SmartCutPaste" because I found that > "PasteSmartCutPaste" does not exist in Word 2000 (and earlier I > think). > > In general, my experience is the all options with the word "smart" in > their names are causing more trouble than most other options - not > least in relation to VBA (which I do not find smart.) . Good catch.. The problem is that these options are generally turned on by default... So, when you code for unknown users, I guess you have to do something like you suggests... Turn them off, and then back to their original setting. Thanks! -- Salut! _______________________________________ Jean-Guy Marcil - Word MVP jmarcilREMOVE(a)CAPSsympatico.caTHISTOO Word MVP site: http://www.word.mvps.org |