You may consider saving the data as a CSV file to a shared drive. The following is code to read and write CSV Files. However, I recommend using MS-Query to read the data from the CSV file. It will bring it in as a table. Also it will preserve the data type. Sometimes when you import a big string that looks like a number, Excel converts it to scientific notation which is not what you generally want.
Option Explicit
' Syntax: ReadCSV CSVPath, CSVFile, PasteSheet, PasteRange
' Syntax: WriteCSV CSVPath, CSVFile, CopySheet, CopyRange
Sub ReadCSV(CSVPath As String, CSVFile As String, PasteSheet As String, PasteRange As String)
Dim xlBook As Excel.Workbook, xlCSV As Excel.Workbook
Set xlBook = ThisWorkbook
Application.DisplayAlerts = False
' Clear the old data
Sheets(PasteSheet).Cells.ClearContents
' Open the CSV File
If Dir(CSVPath & "\" & CSVFile) = "" Then
MsgBox "File " & CSVFile & " does not exist"
Exit Sub
End If
Set xlCSV = Workbooks.Open(CSVPath & "\" & CSVFile)
Cells.Copy
' Paste to CSV
xlBook.Activate
Sheets(PasteSheet).Select
Range(PasteRange).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
' Close the book
xlCSV.Close savechanges:=False
Application.DisplayAlerts = True
End Sub
Sub WriteCSV(CSVPath as String, CSVFile as String, CopySheet as String, CopyRange as String)
Dim xlCSV As Excel.Workbook, xlBook As Excel.Workbook
Application.DisplayAlerts = False
Set xlBook = ThisWorkbook
Sheets(CopySheet).Select
' Create the CSV File
Set xlCSV = Workbooks.Add(xlWBATWorksheet)
' Copy the data
xlBook.ActiveSheet.Range(CopyRange).Copy _
xlCSV.Sheets(1).Range("A1")
' Save and close the CSV File
xlCSV.SaveAs Filename:=CSVPath & "\" & CSVFile, FileFormat:=xlCSVMSDOS
xlCSV.Close savechanges:=True
Application.DisplayAlerts = True
End Sub
Bookmarks