Link to home
Start Free TrialLog in
Avatar of Edward Pamias
Edward PamiasFlag for United States of America

asked on

VBS script to save Tabs as separate Excel xlsx files

I have a large sheet and I have a tab called dashboard and would like to save the whole tab in another file. Keep in mind this tab has many links. Does anyone have a quick VBScript to save this file?
Avatar of regmigrant
regmigrant
Flag of United Kingdom of Great Britain and Northern Ireland image

The basic principle is simple and described here:
http://www.extendoffice.com/documents/excel/628-excel-split-workbook.html#vba

If there are links between the sheets and you want those to become external references then it will need some fettling
Avatar of Edward Pamias

ASKER

I tried that and it did not work for me. I got an error when running it.
the code in there is fairly straight forward but I'll need some help to find out what went wrong:

What error did you get?
When did it happen?

Can you post a sample of the workbook?

I created the attached by following the steps outlined at the link. Copy this into an empty folder and then run the macro from the developer tab and see if it works
NB - it will cause problems if one of the tabs has the same name as the workbook because the new file will attempt to overwrite the old
Book1.xlsm
it stopped at WS.copy after it saved most of the tabs.
I really only need to save one tab, named DASHBOARD.
Avatar of [ fanpages ]
[ fanpages ]

regmigrant: In case this is the root of the issue...

epamias has asked for a solution using VBScript, & the link you posted to ExtendOffice.com points to Visual Basic for Applications code:

Sub Splitbook()
'Updateby20140612
Dim xPath As String
xPath = Application.ActiveWorkbook.Path
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each xWs In ThisWorkbook.Sheets
    xWs.Copy
    Application.ActiveWorkbook.SaveAs Filename:=xPath & "\" & xWs.Name & ".xls"
    Application.ActiveWorkbook.Close False
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub

Open in new window


epamias:

Are you wishing to run code from within MS-Excel, or using a VBScript file?
ASKER CERTIFIED SOLUTION
Avatar of regmigrant
regmigrant
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.