Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Possible bug when recording a Word Macro
Good afternoon. I'm having a problem recording a simple macro in Word. I
first noticed this issue in Word XP, and now again in Word 2003. Here is what I'm trying to do. I want to copy text from a web page and paste it, unformatted, into Word, regardless of the formatting on the web page. Here are the steps I'm taking: 1. Copy any text from any web page 2. In Word, start recording a macro 3. I name it PasteSpecial, assign it to the keyboard (Alt+D), and click Close to start recording 4. I click Edit - Paste Special..., I then select "Unformatted Text" and click OK. At this point, the text appears pasted the way I want it, unformatted. 5. I stop the recording and test the macro by pressing Alt+D 6. The text is pasted with whatever formating was included on the web page Here is the resulting VBA code: Sub PasteSpecial() ' ' PasteSpecial Macro ' Macro recorded 4/29/2005 by USAAC ' Selection.PasteAndFormat (wdPasteDefault) End Sub The problem is that the macro does not record the selection of "Unformatted Text," but instead records the default option in the dialog box, which is "Formatted Text (RTF)," as evidenced by the (wdPasteDefault). It *should* read (wdFormatPlainText) based on the Unformatted Text selection. I have recorded the macro using just the mouse or just the keyboard, both with the same results. Want to know what's even stranger?? If I try to record this same macro in PowerPoint, it doesn't record my actions at all! Here is the resulting VBA code in PowerPoint: Sub PasteSpecial() ' ' Macro recorded 4/29/2005 by USAAC ' End Sub Any help would be greatly appreciated. Thanks! Bill |
#2
|
|||
|
|||
Hi Bill,
Yes, the macro recorder is busted. I wrote a whole article about it (http://word.mvps.org/FAQs/MacrosVBA/...ordedMacro.htm) and didn't even get to this bug. The line the recorder should give you, but never does, is Selection.PasteSpecial DataType:=wdPasteText I haven't tried it in PowerPoint, but I'm not surprised by what you say. :-( -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Raven95 wrote: Good afternoon. I'm having a problem recording a simple macro in Word. I first noticed this issue in Word XP, and now again in Word 2003. Here is what I'm trying to do. I want to copy text from a web page and paste it, unformatted, into Word, regardless of the formatting on the web page. Here are the steps I'm taking: 1. Copy any text from any web page 2. In Word, start recording a macro 3. I name it PasteSpecial, assign it to the keyboard (Alt+D), and click Close to start recording 4. I click Edit - Paste Special..., I then select "Unformatted Text" and click OK. At this point, the text appears pasted the way I want it, unformatted. 5. I stop the recording and test the macro by pressing Alt+D 6. The text is pasted with whatever formating was included on the web page Here is the resulting VBA code: Sub PasteSpecial() ' ' PasteSpecial Macro ' Macro recorded 4/29/2005 by USAAC ' Selection.PasteAndFormat (wdPasteDefault) End Sub The problem is that the macro does not record the selection of "Unformatted Text," but instead records the default option in the dialog box, which is "Formatted Text (RTF)," as evidenced by the (wdPasteDefault). It *should* read (wdFormatPlainText) based on the Unformatted Text selection. I have recorded the macro using just the mouse or just the keyboard, both with the same results. Want to know what's even stranger?? If I try to record this same macro in PowerPoint, it doesn't record my actions at all! Here is the resulting VBA code in PowerPoint: Sub PasteSpecial() ' ' Macro recorded 4/29/2005 by USAAC ' End Sub Any help would be greatly appreciated. Thanks! Bill |
#3
|
|||
|
|||
Thanks for the feedback Jay. It's nice to know I wasn't going crazy.
I also noticed a reply you wrote for a similar question to GR and Daiya Mitchell on 4/4/05. In it, you identified a method for using the Paste Option button as a way to record a Paste Unformatted text macro that would actually work. Thanks, I was hoping there was a way around it. Any word on when/if Microsoft might actually get around to fixing the macro issues? I teach Office apps to a large number of military/military affiliated personnel. They are less than a month away from converting from Office 97, where these macros work, to Office 2003, where it appears that many macros won't work. A vast majority of these personnel use a lot of macros in their daily routines. Anyway, thanks again for the help and have a great day. Bill "Jay Freedman" wrote: Hi Bill, Yes, the macro recorder is busted. I wrote a whole article about it (http://word.mvps.org/FAQs/MacrosVBA/...ordedMacro.htm) and didn't even get to this bug. The line the recorder should give you, but never does, is Selection.PasteSpecial DataType:=wdPasteText I haven't tried it in PowerPoint, but I'm not surprised by what you say. :-( -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Raven95 wrote: Good afternoon. I'm having a problem recording a simple macro in Word. I first noticed this issue in Word XP, and now again in Word 2003. Here is what I'm trying to do. I want to copy text from a web page and paste it, unformatted, into Word, regardless of the formatting on the web page. Here are the steps I'm taking: 1. Copy any text from any web page 2. In Word, start recording a macro 3. I name it PasteSpecial, assign it to the keyboard (Alt+D), and click Close to start recording 4. I click Edit - Paste Special..., I then select "Unformatted Text" and click OK. At this point, the text appears pasted the way I want it, unformatted. 5. I stop the recording and test the macro by pressing Alt+D 6. The text is pasted with whatever formating was included on the web page Here is the resulting VBA code: Sub PasteSpecial() ' ' PasteSpecial Macro ' Macro recorded 4/29/2005 by USAAC ' Selection.PasteAndFormat (wdPasteDefault) End Sub The problem is that the macro does not record the selection of "Unformatted Text," but instead records the default option in the dialog box, which is "Formatted Text (RTF)," as evidenced by the (wdPasteDefault). It *should* read (wdFormatPlainText) based on the Unformatted Text selection. I have recorded the macro using just the mouse or just the keyboard, both with the same results. Want to know what's even stranger?? If I try to record this same macro in PowerPoint, it doesn't record my actions at all! Here is the resulting VBA code in PowerPoint: Sub PasteSpecial() ' ' Macro recorded 4/29/2005 by USAAC ' End Sub Any help would be greatly appreciated. Thanks! Bill |
#4
|
|||
|
|||
Your existing macros from Office 97 will work in and can be transported to
Office 2003, it's only recording new ones that may be problematic--and if you encourage them to use the Paste Options buttons, probably less problematic? There's a twisted sort of logic to how the developers made sure recording with the new paste options button worked, but neglected to check the older methods. If you don't know how to transfer macros when converting to the new version, you could post a new thread, or just search, the answer should be in this forum somewhere. On 4/30/05 10:28 AM, "Raven95" wrote: Thanks for the feedback Jay. It's nice to know I wasn't going crazy. I also noticed a reply you wrote for a similar question to GR and Daiya Mitchell on 4/4/05. In it, you identified a method for using the Paste Option button as a way to record a Paste Unformatted text macro that would actually work. Thanks, I was hoping there was a way around it. Any word on when/if Microsoft might actually get around to fixing the macro issues? I teach Office apps to a large number of military/military affiliated personnel. They are less than a month away from converting from Office 97, where these macros work, to Office 2003, where it appears that many macros won't work. A vast majority of these personnel use a lot of macros in their daily routines. Anyway, thanks again for the help and have a great day. Bill "Jay Freedman" wrote: Hi Bill, Yes, the macro recorder is busted. I wrote a whole article about it (http://word.mvps.org/FAQs/MacrosVBA/...ordedMacro.htm) and didn't even get to this bug. The line the recorder should give you, but never does, is Selection.PasteSpecial DataType:=wdPasteText I haven't tried it in PowerPoint, but I'm not surprised by what you say. :-( -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Raven95 wrote: Good afternoon. I'm having a problem recording a simple macro in Word. I first noticed this issue in Word XP, and now again in Word 2003. Here is what I'm trying to do. I want to copy text from a web page and paste it, unformatted, into Word, regardless of the formatting on the web page. Here are the steps I'm taking: 1. Copy any text from any web page 2. In Word, start recording a macro 3. I name it PasteSpecial, assign it to the keyboard (Alt+D), and click Close to start recording 4. I click Edit - Paste Special..., I then select "Unformatted Text" and click OK. At this point, the text appears pasted the way I want it, unformatted. 5. I stop the recording and test the macro by pressing Alt+D 6. The text is pasted with whatever formating was included on the web page Here is the resulting VBA code: Sub PasteSpecial() ' ' PasteSpecial Macro ' Macro recorded 4/29/2005 by USAAC ' Selection.PasteAndFormat (wdPasteDefault) End Sub The problem is that the macro does not record the selection of "Unformatted Text," but instead records the default option in the dialog box, which is "Formatted Text (RTF)," as evidenced by the (wdPasteDefault). It *should* read (wdFormatPlainText) based on the Unformatted Text selection. I have recorded the macro using just the mouse or just the keyboard, both with the same results. Want to know what's even stranger?? If I try to record this same macro in PowerPoint, it doesn't record my actions at all! Here is the resulting VBA code in PowerPoint: Sub PasteSpecial() ' ' Macro recorded 4/29/2005 by USAAC ' End Sub Any help would be greatly appreciated. Thanks! Bill |
#5
|
|||
|
|||
I agree, there shouldn't be much trouble bringing existing macros
forward -- although it always requires testing, especially with any code that manipulates windows and panes (because these objects have changed several times in going through Word 2000, 2002, and 2003). The recorder often (but not always) can handle new features, but I can't remember an existing recorder bug ever being fixed. I wouldn't hold my breath... VBA itself is a different story. In Word 2000 the VB engine was updated from version 5 to version 6. Some very useful new functions were added: Array(), Split(), and Join() for dealing with arrays in Variants, and Replace() for manipulating strings. These are worth studying. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org On Sat, 30 Apr 2005 10:49:52 -0700, Daiya Mitchell wrote: Your existing macros from Office 97 will work in and can be transported to Office 2003, it's only recording new ones that may be problematic--and if you encourage them to use the Paste Options buttons, probably less problematic? There's a twisted sort of logic to how the developers made sure recording with the new paste options button worked, but neglected to check the older methods. If you don't know how to transfer macros when converting to the new version, you could post a new thread, or just search, the answer should be in this forum somewhere. On 4/30/05 10:28 AM, "Raven95" wrote: Thanks for the feedback Jay. It's nice to know I wasn't going crazy. I also noticed a reply you wrote for a similar question to GR and Daiya Mitchell on 4/4/05. In it, you identified a method for using the Paste Option button as a way to record a Paste Unformatted text macro that would actually work. Thanks, I was hoping there was a way around it. Any word on when/if Microsoft might actually get around to fixing the macro issues? I teach Office apps to a large number of military/military affiliated personnel. They are less than a month away from converting from Office 97, where these macros work, to Office 2003, where it appears that many macros won't work. A vast majority of these personnel use a lot of macros in their daily routines. Anyway, thanks again for the help and have a great day. Bill "Jay Freedman" wrote: Hi Bill, Yes, the macro recorder is busted. I wrote a whole article about it (http://word.mvps.org/FAQs/MacrosVBA/...ordedMacro.htm) and didn't even get to this bug. The line the recorder should give you, but never does, is Selection.PasteSpecial DataType:=wdPasteText I haven't tried it in PowerPoint, but I'm not surprised by what you say. :-( -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Raven95 wrote: Good afternoon. I'm having a problem recording a simple macro in Word. I first noticed this issue in Word XP, and now again in Word 2003. Here is what I'm trying to do. I want to copy text from a web page and paste it, unformatted, into Word, regardless of the formatting on the web page. Here are the steps I'm taking: 1. Copy any text from any web page 2. In Word, start recording a macro 3. I name it PasteSpecial, assign it to the keyboard (Alt+D), and click Close to start recording 4. I click Edit - Paste Special..., I then select "Unformatted Text" and click OK. At this point, the text appears pasted the way I want it, unformatted. 5. I stop the recording and test the macro by pressing Alt+D 6. The text is pasted with whatever formating was included on the web page Here is the resulting VBA code: Sub PasteSpecial() ' ' PasteSpecial Macro ' Macro recorded 4/29/2005 by USAAC ' Selection.PasteAndFormat (wdPasteDefault) End Sub The problem is that the macro does not record the selection of "Unformatted Text," but instead records the default option in the dialog box, which is "Formatted Text (RTF)," as evidenced by the (wdPasteDefault). It *should* read (wdFormatPlainText) based on the Unformatted Text selection. I have recorded the macro using just the mouse or just the keyboard, both with the same results. Want to know what's even stranger?? If I try to record this same macro in PowerPoint, it doesn't record my actions at all! Here is the resulting VBA code in PowerPoint: Sub PasteSpecial() ' ' Macro recorded 4/29/2005 by USAAC ' End Sub Any help would be greatly appreciated. Thanks! Bill |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
What is the difference between Word Perfect and Microsoft Word, a. | New Users | |||
Wordperfect Office 2000 conversion to Word 2003 | New Users | |||
Is there a Fast Search in Word? | New Users | |||
Boiletplates from Word Perfect | Microsoft Word Help | |||
Converted document from WordPerfect. New footnotes are not being. | Microsoft Word Help |