LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Dir function error

Thanks you both for responses.

Rick - using an array to hold the file names, and then doing the logic I
need with each was the short term solution I also had thought of, with the
intention of continuing to look for a more eloquent solution.

Chip - I will be looking more into the Scripting.FileSystem. I have used it
before, I'm just not familiar enough with it to have it be the first thing I
would have thought of when I needed to loop through these files. Also,
thanks for all the information you have put on you web site. I use it
frequently.

"Rick Rothstein" wrote:

You might try storing all the filenames in an array by iterating Dir loop
without doing anything else in it (except saving the filenames to the array)
and then in your current Dir iteration loop, iterate the array elements
instead.

--
Rick (MVP - Excel)


"BigJimmer" wrote in message
...
No, there is no other Dir within the other code not shown (that was
something
I did think of after I posted originally).

I have found a statement I recently added to my code that is causing the
Dir
function to be reset, though I'm not sure why.

The function that causes this is from Chip Pearson's website
(http://www.cpearson.com/Excel/docprop.aspx) -

Function GetProperty(PropertyName As String, PropertySet As
PropertyLocation, _
Optional WhatWorkbook As Workbook) As Variant
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''
' GetProperty
' This procedure returns the value of a DocumentProperty named in
' PropertyName. It will examine BuiltinDocumentProperties,
' or CustomDocumentProperties, or both.

This function works as intended, and the resetting of the value of Dir is
the only dowside for my particular purpose.



"Rick Rothstein" wrote:

I cannot duplicate your problem... the code you posted works fine. Are
you
by any chance using another Dir command (with a different argument) in
the
section you designated "additional logic here"?

--
Rick (MVP - Excel)


"BigJimmer" wrote in message
...
I have the following code...

Dim fName As String
dim DestPath as string

DestPath = ThisWorkbook.Path & "\"
fName = Dir(DestPath & "*.*")
Do Until fName = vbNullString

'additional logic here

fName = Dir
Loop

I get error 5 Invalid procedure call or argument on the line fname =
Dir
and
don't understand why.

I am using Excel 2000.

Thanks!

.


.

 
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
Function error nc Excel Worksheet Functions 1 January 30th 09 02:05 PM
GammaDist function error in error avi Excel Programming 2 November 20th 08 03:55 PM
Excel - User Defined Function Error: This function takes no argume BruceInCalgary Excel Programming 3 August 23rd 06 08:53 PM
IF THEN function error jmcclain Excel Worksheet Functions 10 January 8th 05 12:18 AM
Function Error Rhonda[_3_] Excel Programming 3 December 11th 03 05:34 PM


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

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

About Us

"It's about Microsoft Excel"