I currently import sheets of data into excel that I am exporting from CAD. This includes summaries, counts and other data. I would like to add to the code so that it will import a file from a predetermined directory C:\Jobs\packlist
and using a number inside a cell ='PL CALC'!B1
(this will determine the file name). The idea being to remove the open dialog box and increase automation.
This is what I have found that works so far. It opens a selected file and copies it into the workbook after sheet 18.
'import excel data sheet
Sub import()
Dim fName As String, wb As Workbook
'where to look for the framecad excel file
ChDrive "C:"
ChDir "C:\Jobs\packlist"
fName = Application.GetOpenFilename("Excel Files (*.xl*), *.xl*")
Set wb = Workbooks.Open(fName)
For Each sh In wb.Sheets
Sheets.Copy After:=ThisWorkbook.Sheets(18)
Exit For
Next
wb.Close False
Worksheets("PL CALC").Activate
End Sub