Expected Array error during complie

  • Thread starter Thread starter Jim
  • Start date Start date
J

Jim

1 currentdate = Date
2 CurDate = Format(currentdate, "YYYYMMDD")
3 tardirname = "U:\Finance\Cash Management\Gifts CUSIP Pricing Archive\" &
CurDate
4 If dir(tardirname) = "" Then
5 MkDir (tardirname)
6 End If
7 cpytarget = tardirname + "\"

When I compile the code in a module I'm modifying and it stops at line 4
above with an xpected array error.

What gives.
 
Sorry, Jim, I was one line off. That is a strange error. Try this version
of your code:

tardirname = "U:\Finance\Cash Management\Gifts CUSIP Pricing Archive\" &
Format(Date,"yyyymmdd")
If Len(Dir(tardirname, vbDirectory)) = 0 Then
MkDir (tardirname)
End If
cpytarget = tardirname + "\"

If that doesn't work, then you should check your vba references for any that
might be missing.
 
Klaatu,

Still stopped compiling with the same error. Funny thing, the code ran
perfectly when I was debugging it in its on project module. Once I placed it
into the project I wrote it for, it fails.

Check for any "what" that might be missing?
 
Then it may be corruption creeping in because even as originally written, it
should not have that problem.
 
Jim said:
Still stopped compiling with the same error. Funny thing, the code ran
perfectly when I was debugging it in its on project module. Once I placed it
into the project I wrote it for, it fails.

Check for any "what" that might be missing?


References (on the VBE Tools menu)

If you have selected any library that doesn't exist, is in a
different location or is a different version on this
machine, it can cause all kinds of VBA errors.

Also check to see if you have defined an array named Dir
anywhere in your app or maybe just a typo when you meant to
type something else. Use Find in the VB Editor to search
your entire project for Dir and check to make sure all the
uses are valid.
 
Back
Top