Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Inconsistent error




The following block of code works absolutly fine when in a workbook by
itself, however, when it is part of the module it is intened for it creates
an error on the execute line!

"runtime error 5"
"Invalid procedure call"

I don't know why this is happening and would like an explination or a
pointer to why this maybe happening

If I remove everything in the line beyond Ececute it works fine.

When the error is occuring hovering the mouse over msoSortBy....... gives a
value of Empty. This should not be the case as the code works fine in
another workbook!



With Application.FileSearch
.LookIn = "C:\shop\hist\data"
.SearchSubFolders = False
.FileName = "reple*.xls"
.Execute SortBy:=msoSortByFileName, SortOrder:=msoSortOrderAscending
temp = .FoundFiles(.FoundFiles.Count)
End With


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Inconsistent error

Your code worked ok for me in xl2002 and win98.

I'm not sure why msoSortByFileName would return Empty. Did you use that as a
variable in your program. (take a peek to check.)

Try changing msoSortByFileName to 1 (one) to see if that "fixes" it until you
find out why it's empty.



Stuart wrote:

The following block of code works absolutly fine when in a workbook by
itself, however, when it is part of the module it is intened for it creates
an error on the execute line!

"runtime error 5"
"Invalid procedure call"

I don't know why this is happening and would like an explination or a
pointer to why this maybe happening

If I remove everything in the line beyond Ececute it works fine.

When the error is occuring hovering the mouse over msoSortBy....... gives a
value of Empty. This should not be the case as the code works fine in
another workbook!

With Application.FileSearch
.LookIn = "C:\shop\hist\data"
.SearchSubFolders = False
.FileName = "reple*.xls"
.Execute SortBy:=msoSortByFileName, SortOrder:=msoSortOrderAscending
temp = .FoundFiles(.FoundFiles.Count)
End With


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Inconsistent error

No it hasn't been used as a variable nor has it even been used elsewhere!

Not quite sure what you meant by changing "msoSortByFileName to 1 (one)" I
tried running the line msoSortByFileName=1 immediately before the problem
line, however it made no difference, I still get the same runTime error!



setting it to 1 makes no differance
"Dave Peterson" wrote in message
...
Your code worked ok for me in xl2002 and win98.

I'm not sure why msoSortByFileName would return Empty. Did you use that

as a
variable in your program. (take a peek to check.)

Try changing msoSortByFileName to 1 (one) to see if that "fixes" it until

you
find out why it's empty.



Stuart wrote:

The following block of code works absolutly fine when in a workbook by
itself, however, when it is part of the module it is intened for it

creates
an error on the execute line!

"runtime error 5"
"Invalid procedure call"

I don't know why this is happening and would like an explination or a
pointer to why this maybe happening

If I remove everything in the line beyond Ececute it works fine.

When the error is occuring hovering the mouse over msoSortBy.......

gives a
value of Empty. This should not be the case as the code works fine in
another workbook!

With Application.FileSearch
.LookIn = "C:\shop\hist\data"
.SearchSubFolders = False
.FileName = "reple*.xls"
.Execute SortBy:=msoSortByFileName, SortOrder:=msoSortOrderAscending
temp = .FoundFiles(.FoundFiles.Count)
End With


--

Dave Peterson



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Inconsistent error

..Execute SortBy:=msoSortByFileName, SortOrder:=msoSortOrderAscending
becomes
..Execute SortBy:=1, SortOrder:=msoSortOrderAscending

If you hit ctrl-g to see the immediate window, you can type:

?msoSortByFileName
and hit enter
to see what that constant is defined as.

Try it with msoSortOrderAscending

But that doesn't help why you're having the problem to begin with.

If you look at Tools|References, do you have anything marked MISSING.

If you look at tools|References in the workbook that works, do you have anything
that's "extra". If you do, try checking that reference in the problem workbook.

Stuart wrote:

No it hasn't been used as a variable nor has it even been used elsewhere!

Not quite sure what you meant by changing "msoSortByFileName to 1 (one)" I
tried running the line msoSortByFileName=1 immediately before the problem
line, however it made no difference, I still get the same runTime error!

setting it to 1 makes no differance
"Dave Peterson" wrote in message
...
Your code worked ok for me in xl2002 and win98.

I'm not sure why msoSortByFileName would return Empty. Did you use that

as a
variable in your program. (take a peek to check.)

Try changing msoSortByFileName to 1 (one) to see if that "fixes" it until

you
find out why it's empty.



Stuart wrote:

The following block of code works absolutly fine when in a workbook by
itself, however, when it is part of the module it is intened for it

creates
an error on the execute line!

"runtime error 5"
"Invalid procedure call"

I don't know why this is happening and would like an explination or a
pointer to why this maybe happening

If I remove everything in the line beyond Ececute it works fine.

When the error is occuring hovering the mouse over msoSortBy.......

gives a
value of Empty. This should not be the case as the code works fine in
another workbook!

With Application.FileSearch
.LookIn = "C:\shop\hist\data"
.SearchSubFolders = False
.FileName = "reple*.xls"
.Execute SortBy:=msoSortByFileName, SortOrder:=msoSortOrderAscending
temp = .FoundFiles(.FoundFiles.Count)
End With


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Inconsistent error


"Dave Peterson" wrote in message
...
.Execute SortBy:=msoSortByFileName, SortOrder:=msoSortOrderAscending
becomes
.Execute SortBy:=1, SortOrder:=msoSortOrderAscending

If you hit ctrl-g to see the immediate window, you can type:

?msoSortByFileName
and hit enter
to see what that constant is defined as.

Try it with msoSortOrderAscending

But that doesn't help why you're having the problem to begin with.

If you look at Tools|References, do you have anything marked MISSING.

If you look at tools|References in the workbook that works, do you have

anything
that's "extra". If you do, try checking that reference in the problem

workbook.

Stuart wrote:

No it hasn't been used as a variable nor has it even been used

elsewhere!

Not quite sure what you meant by changing "msoSortByFileName to 1 (one)"

I
tried running the line msoSortByFileName=1 immediately before the

problem
line, however it made no difference, I still get the same runTime error!

setting it to 1 makes no differance
"Dave Peterson" wrote in message
...
Your code worked ok for me in xl2002 and win98.

I'm not sure why msoSortByFileName would return Empty. Did you use

that
as a
variable in your program. (take a peek to check.)

Try changing msoSortByFileName to 1 (one) to see if that "fixes" it

until
you
find out why it's empty.



Stuart wrote:

The following block of code works absolutly fine when in a workbook

by
itself, however, when it is part of the module it is intened for it

creates
an error on the execute line!

"runtime error 5"
"Invalid procedure call"

I don't know why this is happening and would like an explination or

a
pointer to why this maybe happening

If I remove everything in the line beyond Ececute it works fine.

When the error is occuring hovering the mouse over msoSortBy.......

gives a
value of Empty. This should not be the case as the code works fine

in
another workbook!

With Application.FileSearch
.LookIn = "C:\shop\hist\data"
.SearchSubFolders = False
.FileName = "reple*.xls"
.Execute SortBy:=msoSortByFileName,

SortOrder:=msoSortOrderAscending
temp = .FoundFiles(.FoundFiles.Count)
End With

--

Dave Peterson


--

Dave Peterson





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Inconsistent error

Many thanks Dave for your help, "Microsoft Office 8.0 Object Libary" was not
ticked. Why it was not ticked in this particular workbook I have no idea, as
it is selected in every other workbook.

again, many thanks

Stuart


"Dave Peterson" wrote in message
...
.Execute SortBy:=msoSortByFileName, SortOrder:=msoSortOrderAscending
becomes
.Execute SortBy:=1, SortOrder:=msoSortOrderAscending

If you hit ctrl-g to see the immediate window, you can type:

?msoSortByFileName
and hit enter
to see what that constant is defined as.

Try it with msoSortOrderAscending

But that doesn't help why you're having the problem to begin with.

If you look at Tools|References, do you have anything marked MISSING.

If you look at tools|References in the workbook that works, do you have

anything
that's "extra". If you do, try checking that reference in the problem

workbook.

Stuart wrote:

No it hasn't been used as a variable nor has it even been used

elsewhere!

Not quite sure what you meant by changing "msoSortByFileName to 1 (one)"

I
tried running the line msoSortByFileName=1 immediately before the

problem
line, however it made no difference, I still get the same runTime error!

setting it to 1 makes no differance
"Dave Peterson" wrote in message
...
Your code worked ok for me in xl2002 and win98.

I'm not sure why msoSortByFileName would return Empty. Did you use

that
as a
variable in your program. (take a peek to check.)

Try changing msoSortByFileName to 1 (one) to see if that "fixes" it

until
you
find out why it's empty.



Stuart wrote:

The following block of code works absolutly fine when in a workbook

by
itself, however, when it is part of the module it is intened for it

creates
an error on the execute line!

"runtime error 5"
"Invalid procedure call"

I don't know why this is happening and would like an explination or

a
pointer to why this maybe happening

If I remove everything in the line beyond Ececute it works fine.

When the error is occuring hovering the mouse over msoSortBy.......

gives a
value of Empty. This should not be the case as the code works fine

in
another workbook!

With Application.FileSearch
.LookIn = "C:\shop\hist\data"
.SearchSubFolders = False
.FileName = "reple*.xls"
.Execute SortBy:=msoSortByFileName,

SortOrder:=msoSortOrderAscending
temp = .FoundFiles(.FoundFiles.Count)
End With

--

Dave Peterson


--

Dave Peterson



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
Date inconsistent help please :) daisy Excel Worksheet Functions 3 May 28th 10 08:37 PM
VLOOKUP inconsistent ... help. Wayne Excel Discussion (Misc queries) 2 February 22nd 10 09:07 AM
"This cell is inconsistent with the column formula" error Nebulous Excel Worksheet Functions 4 September 11th 09 12:53 AM
inconsistent error message DJ in KC Excel Discussion (Misc queries) 3 February 12th 09 05:10 AM
3-d referencing inconsistent duncan79 Excel Discussion (Misc queries) 5 January 25th 06 05:39 PM


All times are GMT +1. The time now is 05:26 PM.

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"