Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Why does my VBA macro end after opening file?

10 Jan 2014   #11
Peatawn

Windows 7 Home (x64)
 
 

To copy my macros in my new PERSONAL.XLSA, I actually used NotePad as an intermediate. Bloats shouldn't have copied through there, right?


My System SpecsSystem Spec
.
10 Jan 2014   #12
bawldiggle

XP/7x32 & x64/8x64/8.1x64
 
 

Quote:
I actually used NotePad as an intermediate. Bloats shouldn't have copied through there, right?
I assumed you were copying from a module and pasting into a new module in a new workbook.

MSC = MS Clipboard
I am not an expert on the finer points of MSC.
In your case when copying from module to MSC, the previous item is cleared and stores the new item (module), maybe including stuff we dont know about. Considering MSC also copies formatting of Word data (incl formatting) -- text, images, files etc.
But when you copied to Notepad (which results in text only) and recopied Notepad to MSC -- MSC would again clear the old item to hold the new "pure text"

If you want to play with MSC and see just what it holds, create a shortcut to
Code:
C:\WINDOWS\system32\clipbrd.exe
... ie, clipbrd.exe not clipboard.exe
A window that shows the current clip, and you can clear MSC from the same window.
(Almost as exciting as watching paint dry )

I love VBA probably because I have used it since WordBasic days. But I do acknowledge it is prone to instability. VBA has always satisfied all my needs

Regards,
Russell
My System SpecsSystem Spec
28 Apr 2016   #13
Donut67

Windows 7 Enterprise
 
 
Re: Why does my VBA macro end after opening file?

Having seen this problem with one of my macros I search and came across this thread from a while ago. Although labelled 'solved' none the solutions offered were a fix for me. It was not to do with the Shift key being pressed as some suggested. I struggled with the premature macro termination issue (after command Workbooks.Open) for a whole day until I worked it out (quite pleased with myself as an amateur). I did obvserve though that the problem happened with some files that I was trying to open but not others. Then I started looking at what was different between these files. Then it struck me - it was about macros! Although most of the files contained macros, some had ones which automatically activate upon file open (macros within the ThisWorkbook object).
Deactivating these before opening the file did the trick (using Application.EnableEvents = False). Of course you then need to re-enable them after opening the file.

I hope this is of help to someone.
My System SpecsSystem Spec
.

Reply

 Why does my VBA macro end after opening file?




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Problem with opening file
Hello, everytime I click on to open this file (open dns updater) a quick flash of the screen happens but nothing else , it can't open . Any ideas Thanks
General Discussion
File opening
My windows 7 used to work fine, however it has started to refuse to open files, the open save etc box comes up ok at the bottom, but when I click on open it doesn't, my e-mail is orange fs mail, when I click on to open mail it won't. I have checked for virus malware etc and it all comes up clean, I...
General Discussion
Opening a .CDR file ?
I'd like to a open a CorelDraw .cdr file & convert it to .jpg or some other file type. Is there any recommendation on a good freeware program to do this?
Software
BSOD - Opening or attaching file using "File Open" menu
I am having a BSOD problem whenever I try to open a file in MS Word or MS Excel using the "File Open" menu. This problem also occurs when I try to attach a file to a memo (in email using Internet Explorer) and use the "Browse" button and try to choose a file. I have attached the zip file using the...
BSOD Help and Support
opening .car file extensions
high I am rinning win7 x64 home premium and I have been cleaning out my old cd's. I have an old win95 generations deluxe genealogy cd which will not setup in any mode on this computer. there is an social security death index set of 2 cds and I do not want to pitch it. I can mount and view...
Software
File opening
Every few weeks my W7 (Home Premium) takes it into its head to start opening files and folders half-size, so I have to click top right between 'minimise' and 'close' to bring them up to normal full screen to work on them. I have lots of folders within folders so it becomes time-consuming to have...
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 01:12.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App