none
Avoid Word prompt on Paste RRS feed

  • Question

  • Hi,

    I have a macro that copies an entire file into a new document. When the file has a large number of styles, the prompt appears: "Recording Clipboard style sheet will require copying many styles. Do you want to use Normal style instead?" The answer to this prompt will always be No, but the prompt itself will only appear if the document has many styles (the number of styles will vary).

    I've tried using .Paste, .PasteandFormat(wdFormatOriginalFormatting), and even .InsertFile. All bring up the same prompt.

    Is there any way to silently respond to this prompt, or avoid it altogether? My macro is meant to work on a batch of files, so a user might start it and leave their desk. I do not want them to come back to find out that the first file hasn't even processed because of the prompt.

    If the answer is SendKeys, can anyone provide information or a link to information on how to apply SendKeys when the prompt may or may not appear? I'm fairly comfortable with the VBA that I've used, but have managed to avoid SendKeys thus far.

    Using Word 2010, VBA 7, Windows 7.

    Thanks in advance.

    • Edited by cchimi Monday, January 21, 2013 9:12 PM
    Monday, January 21, 2013 9:12 PM

All replies

  • I did figure out how to do this with SendKeys, but not how to determine if the prompt comes up (since SendKeys has to be run before the dialog pops up). Is there a way? Otherwise, I find that my active document gets a tab and an enter inserted at the cursor, which is no good. I've also heard that SendKeys is not very stable, but I'm a bit desperate.
    Tuesday, January 22, 2013 10:39 PM
  • Why not trying with Application.DisplayAlerts=wdAlertsNone

    Actually I could not test but there is 3 constant for wdalertlevel.One of them will sort out the problem.


    Best Regards,
    Asadulla Javed, Kolkata
    ---------------------------------------------------------------------------------------------
    Please do not forget to click “Vote as Helpful” if any post helps you and "Mark as Answer”if it solves the issue.

    Wednesday, January 23, 2013 8:42 AM
    Answerer
  • As I understand DisplayAlerts, that would select the default for that dialog box (which is to change all styles to Normal). If they had an option to pick "the other thing" I'd be golden.
    Wednesday, January 23, 2013 9:57 PM
  • Hi,

    did you find any solution/workaround to this issue?

    I am seeing exact the same issue, which occured in Word VBA macros which worked Ok for years.

    The onyl workaround I found was to use a macro which tries to reduce unused styles, but this doesn't work always and lasts quite long, since you need to scan the whole document for all used styles.

    Regards,

    Christian

    Monday, June 2, 2014 4:09 PM
  • Instead of using paste, will the following work?

    Dim oSource As Document
    Dim oRng As Range
        Set oRng = Selection.Range
        Set oSource = Documents.Open("C:\Path\Filename.docx")
        oRng.FormattedText = oSource.Range
        oSource.Close 0


    Graham Mayor - Word MVP
    www.gmayor.com

    Tuesday, June 3, 2014 9:49 AM
  • Hi, same problem here.

    I'd like to use FormattedText but I need to paste text and tables from multiple sources, not just a single file, to one document. Is there a way to do so?

    Thanks in advance.

    Thursday, March 21, 2019 10:14 AM