Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-11-2025, 10:45 AM
Tony Hedge Tony Hedge is offline How to Pause a Macro and Display a Document Windows 11 How to Pause a Macro and Display a Document Office 2021
Novice
How to Pause a Macro and Display a Document
 
Join Date: Feb 2025
Posts: 1
Tony Hedge is on a distinguished road
Question How to Pause a Macro and Display a Document

I am running Microsoft 365 on Windows 11.




I have developed a Word macro that loops over all the .doc, .docx and .rtf file in a folder and re-formats them.


After I have reformatted each file I wish to display the file briefly (2s) whilst the macro sleeps. I have not found a way to do this.


If I use the Windows Sleep API, it sleeps the document windows as well as the macro.


If have tried using the Excel Wait method, but despite adding a reference to the Microsoft Excel 16.0 Object Library, the macro throws an error when it reaches the Wait statement.


I have tried adding many DoEvent statements, but fails as well.


Does anyone know how to pause a macro (briefly) and display a document window?
Reply With Quote
  #2  
Old 02-11-2025, 11:00 AM
Italophile Italophile is offline How to Pause a Macro and Display a Document Windows 11 How to Pause a Macro and Display a Document Office 2021
Expert
 
Join Date: Mar 2022
Posts: 542
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

What are you hoping to achieve by briefly displaying a document that the user cannot interact with?
Reply With Quote
  #3  
Old 02-11-2025, 04:29 PM
macropod's Avatar
macropod macropod is offline How to Pause a Macro and Display a Document Windows 10 How to Pause a Macro and Display a Document Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,384
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

So why not use
Code:
Application.ScreenRefresh
MsgBox "Reformatted", vbOKOnly
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #4  
Old 02-11-2025, 04:35 PM
macropod's Avatar
macropod macropod is offline How to Pause a Macro and Display a Document Windows 10 How to Pause a Macro and Display a Document Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,384
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Cross-posted at: MS Answers - How to Sleep in Word VBA macro and Briefly Display a Document Window
For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
sleep, vba editor



Similar Threads
Thread Thread Starter Forum Replies Last Post
Drop-down Macro to show different display / value Grif 2200 Word 1 09-13-2019 01:34 PM
Pause a video ako PowerPoint 3 08-30-2019 06:57 AM
Pause tasks automatically schmil Project 0 05-16-2017 10:01 AM
Pause / restart a background MP3 ? Clark711 PowerPoint 3 07-29-2013 10:04 AM
Macro to display help text rusteinberg Word VBA 0 04-03-2013 09:55 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:42 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft