Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default export a non defined table as txt or cvs by VBA

I have in my "Summary" page a table which has four coloumns and an undefined
number of rows. There's nothing under this table, so the firs white line
means the end of it. I need a macro to export this table as a kind of backup,
in a txt o cvs file.

When i search the help file for it, i find just XML exporting, and mapping
(by the way i don't understand what it is)

bye
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default export a non defined table as txt or cvs by VBA

Hi snaggy

Try this that copy the csv in C:\

Sub Save_ActiveSheet_CSV_File()
Dim wb As Workbook
Dim strdate As String
Dim Fname As String
strdate = Format(Now, "dd-mm-yy h-mm-ss")
Fname = "C:\Part of " & ThisWorkbook.Name _
& " " & strdate & ".csv"
Application.ScreenUpdating = False
ActiveSheet.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs Fname, FileFormat:=xlCSV
.Close False
End With
Application.ScreenUpdating = True
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"snaggy^^" wrote in message ...
I have in my "Summary" page a table which has four coloumns and an undefined
number of rows. There's nothing under this table, so the firs white line
means the end of it. I need a macro to export this table as a kind of backup,
in a txt o cvs file.

When i search the help file for it, i find just XML exporting, and mapping
(by the way i don't understand what it is)

bye



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default export a non defined table as txt or cvs by VBA

That was perfect!
Du you know how to extract the path of the current xls so that he can save
the CVS in the same directory?

thanks a lot


"Ron de Bruin" wrote:

Hi snaggy

Try this that copy the csv in C:\

Sub Save_ActiveSheet_CSV_File()
Dim wb As Workbook
Dim strdate As String
Dim Fname As String
strdate = Format(Now, "dd-mm-yy h-mm-ss")
Fname = "C:\Part of " & ThisWorkbook.Name _
& " " & strdate & ".csv"
Application.ScreenUpdating = False
ActiveSheet.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs Fname, FileFormat:=xlCSV
.Close False
End With
Application.ScreenUpdating = True
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"snaggy^^" wrote in message ...
I have in my "Summary" page a table which has four coloumns and an undefined
number of rows. There's nothing under this table, so the firs white line
means the end of it. I need a macro to export this table as a kind of backup,
in a txt o cvs file.

When i search the help file for it, i find just XML exporting, and mapping
(by the way i don't understand what it is)

bye




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default export a non defined table as txt or cvs by VBA

Search XL VBA help for 'path' (w/o the quotes).

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
That was perfect!
Du you know how to extract the path of the current xls so that he can save
the CVS in the same directory?

thanks a lot


{snip}
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default export a non defined table as txt or cvs by VBA

If you have try Tushar's advise your code looks like this

Sub Save_ActiveSheet_CSV_File_2()
Dim wb As Workbook
Dim strdate As String
Dim Fname As String
strdate = Format(Now, "dd-mm-yy h-mm-ss")
Fname = ActiveWorkbook.Path & "\Part of " & ThisWorkbook.Name _
& " " & strdate & ".csv"
Application.ScreenUpdating = False
ActiveSheet.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs Fname, FileFormat:=xlCSV
.Close False
End With
Application.ScreenUpdating = True
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"snaggy^^" wrote in message ...
That was perfect!
Du you know how to extract the path of the current xls so that he can save
the CVS in the same directory?

thanks a lot


"Ron de Bruin" wrote:

Hi snaggy

Try this that copy the csv in C:\

Sub Save_ActiveSheet_CSV_File()
Dim wb As Workbook
Dim strdate As String
Dim Fname As String
strdate = Format(Now, "dd-mm-yy h-mm-ss")
Fname = "C:\Part of " & ThisWorkbook.Name _
& " " & strdate & ".csv"
Application.ScreenUpdating = False
ActiveSheet.Copy
Set wb = ActiveWorkbook
With wb
.SaveAs Fname, FileFormat:=xlCSV
.Close False
End With
Application.ScreenUpdating = True
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"snaggy^^" wrote in message ...
I have in my "Summary" page a table which has four coloumns and an undefined
number of rows. There's nothing under this table, so the firs white line
means the end of it. I need a macro to export this table as a kind of backup,
in a txt o cvs file.

When i search the help file for it, i find just XML exporting, and mapping
(by the way i don't understand what it is)

bye






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
salary defined by slab table XKruodo Excel Worksheet Functions 5 March 21st 10 03:08 AM
Export Pivot Table Data to Excel Table Milind Keer[_2_] Excel Discussion (Misc queries) 0 October 8th 08 04:53 PM
Export excel table to acess table using VBA Code Jof Excel Programming 1 September 30th 05 04:46 PM
Export table to SQL winter Excel Programming 3 February 10th 05 08:43 AM
How to export pivot table to a plain table? RADO[_3_] Excel Programming 4 December 3rd 03 09:01 AM


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

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

About Us

"It's about Microsoft Excel"