![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Mar 2002
Location: George
Posts: 4
|
I have a macro that opens a workbook, then tries to copy data from a specified area. WHen I run the macro, I get the error:
Run Time Error 1004 The macro stops, but the desired workbook is open. The code I am using is: Sub CopyDataFromWeek() Dim SheetName As String Dim FullName As String SheetName = Range("A19") & ".xls" FullName = "C:AwipTsp43_xls" & SheetName Workbooks.Open FileName:=FullName And teh last line is highlighted. Any ideas?? |
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Christchurch New Zealand
Posts: 1,030
|
Quote:
Suggest that maybe something is wrong with your path otherwise everything should be a ok |
|
|
|
|
|
|
#3 |
|
New Member
Join Date: Mar 2002
Location: George
Posts: 4
|
The path in my code has single backslashes, the test in this post has double slashes. I assume you are using single slashes in the path name?
|
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
FullName is a property of the Workbook object.
Ex. Workbook.FullName Not a good idea to use variables with the same name of a property in the object model you are working with. I would chage FullName to something else... Tom |
|
|
|
|
|
#5 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Christchurch New Zealand
Posts: 1,030
|
Yeah what Tom said
for some reason when you post it puts in double slashes don;t know why! |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|