Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 07-23-2018, 09:13 PM
macropod's Avatar
macropod macropod is offline Alot of Flashes changing windows Windows 7 64bit Alot of Flashes changing windows Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,370
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

As suspected, you have lots of 'Windows(#).Activate' and 'Selection' code in there. There is no need for either. For example:
you might use:
Code:
Sub GenByChapter()
' Generate Technician questions by chapters
'
Dim p As Paragraph
Dim pstring As String
Dim MaxNumber As Long
Dim TabLocation As Long
Dim QuestionAnswerRange As Range
Dim StartWord As String, EndWord As String, ftest As String
Dim OldChapter As Long
MaxNumber = 0

Dim Doc1 As Document, Doc2 As Document

Windows("2018-2022 Tech Pool Macro.docm").Activate
Set Doc1 = ActiveDocument
Application.ScreenUpdating = False

Set Doc2 = Documents.Open(FileName:="\Users\Kenneth\Documents\Amateur Radio\New q downloads\questions by chapters 2018.docx", _
  ReadOnly:=True, AddToRecentFiles:=False, Visible:=False)
With Doc2
  For Each p In .Paragraphs
    ' convert paragraph to a string of characters
    pstring = Split(p.Range.Text, vbCr)(0)
    TabLocation = InStr(1, pstring, Chr(9))
    MaxNumber = MaxNumber + 1
    ChapterArray(MaxNumber) = Mid$(pstring, 1, TabLocation - 1)
    QuestionArray(MaxNumber) = Mid$(pstring, TabLocation + 1)
  Next p
  ' close the document with the questions by chapter
  .Close False
End With
OldChapter = -9
Set Doc2 = Documents.Add(Template:="Normal", NewTemplate:=False, DocumentType:=0)
Call SetMargins(Doc2)
'...
Application.ScreenUpdating = True
End Sub
'...
Sub SetMargins(Doc As Document)
With Doc.PageSetup
'...
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 

Tags
flashes, vba code



Similar Threads
Thread Thread Starter Forum Replies Last Post
Alot of Flashes changing windows Windows 10 – Changing the Office 2007 Product Key. ansentry Office 2 12-07-2015 07:41 PM
Alot of Flashes changing windows Convert Ofc 2000/Windows XP OS docs to Windows 7 OS which has NO Ofc Version Loaded mylittleturbott Office 2 03-17-2014 03:18 PM
Alot of Flashes changing windows Problem typing alot of text into a middle column noelr Word Tables 3 10-02-2013 02:19 PM
Alot of Flashes changing windows Outlook requests password afeter changing windows password pask Outlook 5 03-16-2012 08:43 AM
screen flashes black when writing docsobeck PowerPoint 0 02-01-2010 11:09 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:58 AM.


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