Save worksheet as a separate workbook with XL2007 via macro issue

ron2k

Board Regular
Joined
Jan 28, 2008
Messages
139
With my limited skills I was able to come up with the following code:
Code:
Private Sub SaveWS()
    Dim wb As Workbook
    ActiveWorkbook.Worksheets(cboRptname.Value).Copy
    Set wb = ActiveWorkbook
    wb.SaveAs Filename:="\\Treasury\Accounts\CNDL\" & cboYear.Value & "\" & BoxQtr.Value & "\Portfolios\" & _
        BoxMonthText.Value & "\" & cboRptname.Value & " " & cboYear.Value & cboMonth.Value & cboDay.Value & ".xls"
    wb.Close
End Sub
each of the cbo
[*] and Box
[*] values are from comboboxes and disabled textboxes from a form in the same wb - it works perfect from a workbook saved as xl2007 file. So what it does is to take sheet (cboRptname.Value) to a separate wb and then save it as xls file.

But when I try to open the file, it tells that the file contains a different file extension than the actual file format. And is true, because after it tell me that and allows (on the same xl2007 version) to open the file, I can see that it has 1 mil+ rows, so it is not an xls file.

What can I do in that case guys?

Thanks,

Ron
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Thanks Bradley, but not quite sure how that could help as the file format issue is not addressed in the code execution
 
Upvote 0

Forum statistics

Threads
1,224,588
Messages
6,179,743
Members
452,940
Latest member
rootytrip

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