#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 - error saving file & error loading dll TinaF Excel Discussion (Misc queries) 0 July 1st 09 01:49 PM
Error of slope taking into account error of the data points cer144 Excel Worksheet Functions 5 July 7th 08 07:26 PM
Counting instances of found text (Excel error? Or user error?) S Davis Excel Worksheet Functions 5 September 12th 06 04:52 PM
Error 50290: Error writing to Worksheet while using an ActiveX Control emblair3 Excel Programming 3 February 24th 04 06:03 PM


All times are GMT +1. The time now is 07:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"