![]() |
Trying to write vba code to import another spreadsheet...
I know this is simple, but it's not working for me. When I import another
spreadsheet a number of column names are not imported. The columns are not on the first row. The first column being 'employee id'. I also tried transferspreadsheet command, but my code isn't even recognizing the docmd. Any hints? -- Otium Cum Dignatate |
Trying to write vba code to import another spreadsheet...
"joep3" wrote in message ... I know this is simple, but it's not working for me. When I import another spreadsheet a number of column names are not imported. The columns are not on the first row. The first column being 'employee id'. I also tried transferspreadsheet command, but my code isn't even recognizing the docmd. Any hints? -- Otium Cum Dignatate Why not import the entire sheet rather than a subsection? <snip Worksheets.Add , Count:=1 Workbooks.Open FileName:="full path of filename to copy", ReadOnly:=True Cells.Select: Selection.Copy ThisWorkbook.Sheets("Sheet4").Activate: ActiveSheet.Paste Workbooks("file opened above").Close savechanges:=False <snip |
Trying to write vba code to import another spreadsheet...
Hi thanks for getting back to me!
The reason the header is missing in some instances is that the header doesn't match the data type that the column is under. I am importing the whole sheet, using the Import data routine and recording that then editing the recorded call for a procedure. The issue, however, is still unresolved. I am receiving an unknown sheet with certain columns I am to find and filter out. The columns are not garanteed to be in the first column. ( the columns are imported corectly if this is true.) So, how do I tell the import to import the whole sheet in text, so all the column names are imported. I can do the conversion myself. -- Otium Cum Dignatate "Jef Gorbach" wrote: "joep3" wrote in message ... I know this is simple, but it's not working for me. When I import another spreadsheet a number of column names are not imported. The columns are not on the first row. The first column being 'employee id'. I also tried transferspreadsheet command, but my code isn't even recognizing the docmd. Any hints? -- Otium Cum Dignatate Why not import the entire sheet rather than a subsection? <snip Worksheets.Add , Count:=1 Workbooks.Open FileName:="full path of filename to copy", ReadOnly:=True Cells.Select: Selection.Copy ThisWorkbook.Sheets("Sheet4").Activate: ActiveSheet.Paste Workbooks("file opened above").Close savechanges:=False <snip |
Trying to write vba code to import another spreadsheet...
Thanks Jeff,
I replied before tryiing your code. It works. Thanks! -- Otium Cum Dignatate "Jef Gorbach" wrote: "joep3" wrote in message ... I know this is simple, but it's not working for me. When I import another spreadsheet a number of column names are not imported. The columns are not on the first row. The first column being 'employee id'. I also tried transferspreadsheet command, but my code isn't even recognizing the docmd. Any hints? -- Otium Cum Dignatate Why not import the entire sheet rather than a subsection? <snip Worksheets.Add , Count:=1 Workbooks.Open FileName:="full path of filename to copy", ReadOnly:=True Cells.Select: Selection.Copy ThisWorkbook.Sheets("Sheet4").Activate: ActiveSheet.Paste Workbooks("file opened above").Close savechanges:=False <snip |
All times are GMT +1. The time now is 04:51 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com