#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 468
Default Device I/O Error

After stepping thru my code I'm getting the aboce message.
What does this usually mean? Any hints would be helpful.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 468
Default Device I/O Error

I have this code in my Userform code window (if that helps).

Private Sub CommandButton1_Click()
Unload Me
ThisWorkbook.Close savechanges:=False
End Sub

"JMay" wrote:

After stepping thru my code I'm getting the aboce message.
What does this usually mean? Any hints would be helpful.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,203
Default Device I/O Error

Generally, "Device I/O Error" is hardware related. You might give strong
consideration to making sure you have a good backup strategy in place for
whatever drive you are using to save those files on.

BTW: You shouldn't even need the "Unload Me" statement in your sub ... it's
going to be unloaded when the ThisWorkbook.Close statement executes.

The Unload Me may even be confusing things (haven't tested it) because
Unload means to take it out of memory, which would, in theory at least,
remove the code in it also.

"JMay" wrote:

After stepping thru my code I'm getting the aboce message.
What does this usually mean? Any hints would be helpful.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 468
Default Device I/O Error

Thanks JLatham;
Your logic makes total sense. I removed the Unload me (line) and things
seem to be working better.
Jim

"JLatham" wrote:

Generally, "Device I/O Error" is hardware related. You might give strong
consideration to making sure you have a good backup strategy in place for
whatever drive you are using to save those files on.

BTW: You shouldn't even need the "Unload Me" statement in your sub ... it's
going to be unloaded when the ThisWorkbook.Close statement executes.

The Unload Me may even be confusing things (haven't tested it) because
Unload means to take it out of memory, which would, in theory at least,
remove the code in it also.

"JMay" wrote:

After stepping thru my code I'm getting the aboce message.
What does this usually mean? Any hints would be helpful.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,203
Default Device I/O Error

Interesting that it continues to work without error. I opened a new
workbook, set up a userform with a command button and put the 2 statements in
it, as you originally had them. Saved it all "just in case" (a good thing).
When I clicked the button I got an Excel (2003) has stopped running error.
Took out the Unload Me statement and I still got the same error with just the
ThisWorkbook.Close False
statement in it.

Might be a better thing if you set a global flag in the routine to test on
return and do the close in a regular code module if you experience any
problems later on with this piece. Code might look something like this:

Private Sub CommandButton1_Click()
globalCloseWorkbookFlag = True
Unload Me
End Sub

then back in your code that called the UserForm, it might look something
like this
up in a declaration section of a module you'd have
Public globalCloseWorkbookFlag as Boolean

then down in the code that calls the UserForm:

.... other code ahead of this section
globalCloseWorkbookFlag = False
UserForm1.Show
If globalCloseWorkbookFlag Then
ThisWorkbook.Close False
Exit Sub
End if
.... more code for when the workbook is not to be closed


Sub
"JMay" wrote:

Thanks JLatham;
Your logic makes total sense. I removed the Unload me (line) and things
seem to be working better.
Jim

"JLatham" wrote:

Generally, "Device I/O Error" is hardware related. You might give strong
consideration to making sure you have a good backup strategy in place for
whatever drive you are using to save those files on.

BTW: You shouldn't even need the "Unload Me" statement in your sub ... it's
going to be unloaded when the ThisWorkbook.Close statement executes.

The Unload Me may even be confusing things (haven't tested it) because
Unload means to take it out of memory, which would, in theory at least,
remove the code in it also.

"JMay" wrote:

After stepping thru my code I'm getting the aboce message.
What does this usually mean? Any hints would be helpful.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
text pc device Dee Excel Discussion (Misc queries) 1 January 5th 09 01:56 AM
How do you export excel data to a PDA, Palm device ? Dr. Jim Silverman Excel Discussion (Misc queries) 1 March 10th 08 04:44 PM
Beam a file to a device. Wolfgang Excel Worksheet Functions 2 October 28th 07 09:31 PM
Excel - Human Interface Device How To sswcharlie1 Excel Discussion (Misc queries) 4 December 20th 06 09:04 PM
Device I/O Error jason Excel Discussion (Misc queries) 0 December 3rd 04 01:28 PM


All times are GMT +1. The time now is 08:09 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"