PC Review


Reply
Thread Tools Rate Thread

Auto close .csv files

 
 
saman110 via OfficeKB.com
Guest
Posts: n/a
 
      21st Sep 2007
hello,

Is it possible to close a .csv file while you are in .xlsm. Here is my
situation, I have a .xlm file and a .csv file open at the save time and I
would like to run a macro that closes the .csv file. My problem is I can not
give it specific file name to close because .csv is auto saves it self every
day with different name, so I have to close all *.csv files.

any help.
thx.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200709/1

 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      21st Sep 2007
You could use a macro that closes all the .csv files:

Option Explicit
Sub testme01()
Dim wkbk As Workbook

For Each wkbk In Application.Workbooks
If LCase(Right(wkbk.Name, 4)) = LCase(".csv") Then
wkbk.Close savechanges:=False
End If
Next wkbk

End Sub



"saman110 via OfficeKB.com" wrote:
>
> hello,
>
> Is it possible to close a .csv file while you are in .xlsm. Here is my
> situation, I have a .xlm file and a .csv file open at the save time and I
> would like to run a macro that closes the .csv file. My problem is I can not
> give it specific file name to close because .csv is auto saves it self every
> day with different name, so I have to close all *.csv files.
>
> any help.
> thx.
>
> --
> Message posted via OfficeKB.com
> http://www.officekb.com/Uwe/Forums.a...excel/200709/1


--

Dave Peterson
 
Reply With Quote
 
saman110 via OfficeKB.com
Guest
Posts: n/a
 
      21st Sep 2007
Thank you bro. worked fine.

Dave Peterson wrote:
>You could use a macro that closes all the .csv files:
>
>Option Explicit
>Sub testme01()
> Dim wkbk As Workbook
>
> For Each wkbk In Application.Workbooks
> If LCase(Right(wkbk.Name, 4)) = LCase(".csv") Then
> wkbk.Close savechanges:=False
> End If
> Next wkbk
>
>End Sub
>
>> hello,
>>

>[quoted text clipped - 10 lines]
>> Message posted via OfficeKB.com
>> http://www.officekb.com/Uwe/Forums.a...excel/200709/1

>


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200709/1

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I stop the close method in an auto close macro =?Utf-8?B?UGF1bA==?= Microsoft Excel Programming 2 17th Nov 2006 02:48 PM
how to solve the auto-close of word 2003 when opening many files? =?Utf-8?B?aG93IHRvIHNvbHZlIHRoZSBhdXRvLWNsb3NlIG9m Microsoft Word Document Management 2 22nd Jun 2005 02:09 PM
Auto Excel workbook close: save= false during an auto subroutine =?Utf-8?B?dG9td2FzaGVyZTI=?= Microsoft Excel Programming 10 16th Jun 2005 06:23 AM
How do I auto check in files when I close it in front page? =?Utf-8?B?RC1Nb25leQ==?= Microsoft Frontpage 1 7th Jun 2005 08:34 AM
Close all programs / Shut Down windows does not auto close outlook =?Utf-8?B?TUtlcw==?= Microsoft Word Document Management 2 22nd Aug 2004 11:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:02 PM.