Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I use the piece of code below in 3 macros in three different workbooks to
open files. In one of the macros it will not work. I get the following error: run time error '1004' pobcinv.xls could not be found..... It's looking for my filename with an xls entension. Can it I make it not look for the file name with an extension. It must be something unique to this one workbook since this is the only one that errors. If there is a solution I'll add it to the othere macro's. Thanks Sub Open_File() Workbooks.OpenText Filename:= _ "\\123.456.78.9\windows\inventory\DailyPackingList s\Vendor1\pobcinv" _ , Origin:=437, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _ xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _ , Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(1, 1), _ TrailingMinusNumbers:=True |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Perhaps something like:
Sub Open_File() Dim sPath as String, sName as String, sFile as String sPath = "\\123.456.78.9\windows\inventory\DailyPackingList s\Vendor1\" sName = "pobcinv" sFile = Dir(sPath & sName & ".*") if sFile < "" then Workbooks.OpenText Filename:= _ spath & sFile, _ Origin:=437, StartRow:=1, _ DataType:=xlDelimited, _ TextQualifier:=xlDoubleQuote, _ ConsecutiveDelimiter:=False, _ Tab:=False, _ Semicolon:=False, _ Comma:=False, _ Space:=False, _ Other:=False, FieldInfo:=Array(1, 1), _ TrailingMinusNumbers:=True -- Regards, Tom Ogilvy "Grant" wrote in message ... I use the piece of code below in 3 macros in three different workbooks to open files. In one of the macros it will not work. I get the following error: run time error '1004' pobcinv.xls could not be found..... It's looking for my filename with an xls entension. Can it I make it not look for the file name with an extension. It must be something unique to this one workbook since this is the only one that errors. If there is a solution I'll add it to the othere macro's. Thanks Sub Open_File() Workbooks.OpenText Filename:= _ "\\123.456.78.9\windows\inventory\DailyPackingList s\Vendor1\pobcinv" _ , Origin:=437, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _ xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False _ , Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(1, 1), _ TrailingMinusNumbers:=True |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Run time error 1004, General ODBC error | New Users to Excel | |||
Run Time Error 1004 | Excel Programming | |||
Run time error '1004' | Excel Programming | |||
Run time error 1004 | Excel Programming |