View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Closing non EXCEL files

Regardless, if opened in excel, they can be treated as workbooks.

If myfilename is a string variable with the file name

workbooks(MyfileName).Close SaveChanges:=False

if myFilename is a workbook variable with a reference to the file you code
should work, so I assume it is the above although I would use

MyFileName.Close SaveChanges:=False in that case

--
Tom Ogilvy


"Grace" wrote in message
...
After opening some text files via CSV and editing, then copying from them,

I
want to close them. Someone suggested:

myFilename.Saved = True '
myFilename.Close

but it bombed the macro ("object required" error message). And I suspect

I
did not make it clear that, though they are opened in EXCEL, these are

not,
nor were they ever, EXCEL files. So, perhaps the commands need to be
different.

Can someone suggest revised commands?

Thanks,
Grace