Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » Help needed with VBS Macro in WINWORD
Closed Thread
Old 03-08-2005, 02:58 PM   #1 (permalink)
 
Ultra Techie

Join Date: Mar 2004

Posts: 573

Cunjo is on a distinguished road

Send a message via ICQ to Cunjo Send a message via Yahoo to Cunjo
Default Help needed with VBS Macro in WINWORD

Hi,

I'm trying to write a macro for WINWORD, and there seems to be some kind of problem with the macro recorder not recognizing the paste settings I specify.

I'm trying to get the macro to paste ONLY the text in the clipboard
using the 'Edit'>'Paste Special...'>'Unformatted Text' operation. This is essential, because along with the text in the clipbord for the intended procedure is a sinificant number of check boxes and hyperlinks -- so many, that attempting to simply paste it all into word causes the program to lock up and stop responding. When I record the macro, I specify the above paste setting, and it pastes the text in the clipboard, just as it is supposed to, I then continued to record the remainder of the macro, which was mostly a string of find-replace commands.

Unfortunately, when the macro is executed, it does not observe the paste settings, and attempts to paste the text with all of he formatting, images, links and so-on, and Word crashes. The VBS statement it uses is:

Selection.PasteAndFormat (wdPasteDefault)

Is there any alternative VBS statement or recording method I could use to accomplish the task I need?

PS. The Macro is designed to seperate the 200-300 or so needed strings in an HTML document from the formatting and unecessary data, and add to the strings to make them recognizable by a specific web-based application. Aside from the initial paste statement which locks up word, the rest runs perfectly (verified by performing the paste-special operation FIRST and then cutting the text-only result from the document before running the macro)

any help would be apprecuated, thanks =)
__________________
\"I\'ll do it cheap, I\'ll do it fast, or I\'ll do it well. You can only choose two.\"
Cunjo is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On