Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error
RonS,
I put your code into an Excel 2002 workbook. Substituted the names of my workbooks. And it worked liked a champ. The code didn't care if the 'filepath' workbook was already opened or not. If it was already opened - the code just reopened it... hth steveb "RonS" wrote in message ... When running a macro to import data from another excel file I'm getting the following error message. "A document with the name "file_name.xls" is already open. You cannot open two docs with the same name, even if the docs are in different folders. To open the second doc, either close the cod that's open, or rename one of the documents." IN this case only one document is open, so I don't know why I'm getting this message. Unless I have some excel options turned on that are causing this issue. The macro is as follows: Sub Import_Real_Estate_V6() ' ' Import_Real_Estate_V6 Macro ' Macro recorded 4/21/2004 by H241428 ' '05-May-03 KL: Obtain the directory location of the current file and combine it with the import file Dim filepath As Variant filepath = Application.ThisWorkbook.Path & "\" & "Real_Estate_Project_Plan_MilestonesV6.xls" '05-May-03 KL End ' Range("A1").Select Workbooks.Open Filename:=filepath Range("A1").Select ActiveWindow.SmallScroll Down:=11 Range("O95").Select ActiveWindow.LargeScroll Down:=-1 Range("A1").Select ActiveWindow.LargeScroll Down:=1 Range("A1:O95").Select Selection.Copy Windows("Real_Estate_Practices_MilestoneScoreCardV 6.0.xls").Activate ActiveWindow.WindowState = xlNormal ActiveSheet.Paste ActiveWindow.SmallScroll ToRight:=3 Range("A2").Select End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel 2007 - error saving file & error loading dll | Excel Discussion (Misc queries) | |||
Error of slope taking into account error of the data points | Excel Worksheet Functions | |||
Counting instances of found text (Excel error? Or user error?) | Excel Worksheet Functions | |||
Error 50290: Error writing to Worksheet while using an ActiveX Control | Excel Programming |