Excel: VBA copy and saveas method issue

allen.chengeliang

New Member
Joined
Feb 23, 2011
Messages
1
Hi Guys,

I had one issue in copy and saveas menthod, i am trying to copy one worksheet from existing workbook to a new workbook which saved as csv format, the new workbook and the worksheet is created but all records in the old worksheet are NOT being copied over, anyone have idea about this?

Besides, i had one suspect that since i am using company licensed office sw, when the new workbook is saving, workbook calssification windows is prompted out and asking to choose the classification type, could it be a reason also? below is the coding:

Set oWBs = Workbooks
Set oNewWB = oWBs.Add
ThisWorkbook.Worksheets(oWS.Name).Copy oNewWB.Worksheets("Sheet1")
sTableName = UCase(sTablePrefix) & UCase(oWS.Name)
sCSVFileName = sCSVOutputFolder & sTableName & ".csv"
oNewWB.SaveAs sCSVFileName, xlCSV
oNewWB.Close True

Thanks in advance!

Allen
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,224,507
Messages
6,179,176
Members
452,893
Latest member
denay

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top