Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 10-13-2023, 01:02 AM
ArviLaanemets ArviLaanemets is offline The best way to avoid opened files to be activated Windows 8 The best way to avoid opened files to be activated Office 2016
Expert
The best way to avoid opened files to be activated
 
Join Date: May 2017
Posts: 960
ArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant futureArviLaanemets has a brilliant future
Default

The crashing was caused by exessive 'Exit For' in my code. I divided my script into separate blocks to lessen the amount of nestings - so now I have better overview of them!

Also I now open the every source file I read the data from in a separate instance, and close it after the data are read and processed. Like:
Code:
...
Dim oInst As Object
...
For strSourceNameRow = 1 To NumberOfSourceFiles
        strSourceFile = <full path for source file to be opened>
        Set oInst = GetObject(strSourceFile)
...
        GoTo ExitSourceNameRow
...
ExitSourceNameRow:
        ' Activate the converter file, and Close the source file
        Workbooks(strSourceFileName).Activate
        Workbooks(strSourceFileName).Close savechanges:=False
        oInst.Close
        Set oInst = Nothing
        Workbooks(strThisFile).Activate
...
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can employer see private files opened in Office 365 thosdmg Office 0 02-27-2023 01:13 AM
The best way to avoid opened files to be activated list of Opened excel files SDondeti Word VBA 10 05-10-2018 03:52 PM
vba opened word files lock up sometimes littlepeaks Word VBA 1 01-28-2016 01:16 PM
XLM Files are not being opened in newer version of Microsoft Office 2013 KetulShah Excel 0 03-18-2014 08:23 PM
The best way to avoid opened files to be activated How to download prev. opened Gmail files. libertyfelix Outlook 1 03-25-2012 09:10 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:24 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