Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default VBA Convert only a particular worksheet to CSV

Hi,

I am writing a script which converts xls to csv.
However, before it save / converts it to csv, it should only be
selecting the correct worksheet and not whatever is shown when opened
up.

I have tried this

Workbooks.Open fileName:=fileNames(i)
ActiveWorkbook.Worksheets("wksTest").Activate
ActiveWorkbook.SaveAs fileName:=Left(fileNames(i),
Len(fileNames(i)) - 4) & ".csv", FileFormat:=xlCSV
ActiveWorkbook.Close


However it doesn't like the Activate command there. Whats wrong with
it?

Thanks.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Convert only a particular worksheet to CSV


try select instead of activat

--
Mallyca
-----------------------------------------------------------------------
Mallycat's Profile: http://www.excelforum.com/member.php...fo&userid=3551
View this thread: http://www.excelforum.com/showthread.php?threadid=56233

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default VBA Convert only a particular worksheet to CSV

Select doesn't work.

It says:
"Code Execution has been interrupted"



Mallycat wrote:
try select instead of activate


--
Mallycat
------------------------------------------------------------------------
Mallycat's Profile: http://www.excelforum.com/member.php...o&userid=35514
View this thread: http://www.excelforum.com/showthread...hreadid=562338


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default VBA Convert only a particular worksheet to CSV

Dim WB As Workbook

Set WB=Workbooks.Open fileName:=fileNames(i)
WB.Worksheets("wksTest").SaveAs fileName:=Left(fileNames(i),
Len(fileNames(i)) - 4) & ".csv", FileFormat:=xlCSV
WB.Close

NickHK

wrote in message
oups.com...
Hi,

I am writing a script which converts xls to csv.
However, before it save / converts it to csv, it should only be
selecting the correct worksheet and not whatever is shown when opened
up.

I have tried this

Workbooks.Open fileName:=fileNames(i)
ActiveWorkbook.Worksheets("wksTest").Activate
ActiveWorkbook.SaveAs fileName:=Left(fileNames(i),
Len(fileNames(i)) - 4) & ".csv", FileFormat:=xlCSV
ActiveWorkbook.Close


However it doesn't like the Activate command there. Whats wrong with
it?

Thanks.



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
How do I convert Quattro Pro worksheet? Ralph Osborne Excel Discussion (Misc queries) 3 January 3rd 07 11:59 PM
I am trying to convert an excel worksheet to a pdf. Lauri Excel Programming 2 May 17th 06 04:22 PM
Convert currency of the whole worksheet PH Excel Discussion (Misc queries) 1 February 13th 06 10:41 PM
Macro to convert Name of worksheet G Setting up and Configuration of Excel 7 November 22nd 05 09:31 PM
Convert Worksheet to Userform Brian C Excel Discussion (Misc queries) 1 October 3rd 05 08:08 PM


All times are GMT +1. The time now is 02:04 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"