Open A Single File Export the Data with VBA
Opening a file with Excel VBA and putting the data from your current file in the newly opened file is known as exporting data. This is done in much the same way as the prior example Import Data with VBA and is achieved by changing some of the variables. The newly exported data is saved once the VBA process is complete. The following is an example;
Sub OpenExp() 'Excel VBA to open a specific workbook and export information.
Dim sh As Worksheet
'Open a file called England (Change to suit).
owb.Close True 'Close opened workbook save (very Important to Save)
The above Excel VBA procedure takes the data in the workbook your starting workbook, copies it, it then opens a workbook called England and pastes the values in cell A1. The workbook is then saved and the workbook is closed (Close True - is for saving with close). The next time the England.xls workbook is opened the new data will be contained within it. Ensure the data is correct in relation to the file path.