This forum has been moved to TeachExcel.com
Ask all future questions in the New Excel Forum.
ExcelKey
Debug.Print FilePath & FilePrefix & "*." & FileType
"C:\Users\Souza\Desktop\OOS\"
"Macintosh HD:Users:Souza:Desktop:OOS:"
Private Function GetFileNames(ByRef FileNames() As String) As Boolean
Dim FilePrefix As String
Dim NextFile As String
Dim i As Integer
FilePrefix = GetFilePrefix
If FilePrefix = vbNullString Then Exit Function
NextFile = Dir(FilePath, MacID(FileType))
Do While NextFile <> vbNullString
If Instr(1, NextFile, FilePrefix, vbTextCompare) = 1 Then
ReDim Preserve FileNames(i)
FileNames(i) = FilePath & NextFile
NextFile = Dir("")
i = i + 1
End If
Loop
GetFileNames = Not (Not FileNames)
End Function
but the only way to really solve the problem is to find the MacID. It should be in your Mac somewhere or in whatever help they provide on or offline.http://office.microsoft.com/en-us/access-help/dir-function-HA001228824.aspx
Private Function StoreName(ByVal Wbname As String) As String
Dim Sp() As String
Dim S As String
Dim i As Integer
' expected format is similar to "YYMMDD STOCK - Store Name.xlsx"
' The word "STOCK" must be present
Sp = Split(Wbname, Application.PathSeparator)
S = Sp(UBound(Sp))
i = InStr(1, S, "STOCK", vbTextCompare)
If i Then
S = Trim(Mid(S, i + Len("STOCK") + 1))
If Left(S, 1) = "-" Then S = Trim(Mid(S, 2))
End If
StoreName = TruncExtn(S)
End Function
Private Function TruncExtn(ByVal Fn As String) As String
Dim i As Integer
Do
i = i + 1
If Asc(Right(Fn, i)) = Asc(".") Then Exit Do
Loop While i < Len(Fn)
If i < Len(Fn) Then Fn = Left(Fn, Len(Fn) - i)
TruncExtn = Fn
End Function
Private Function StoreName(ByVal Wbname As String) As String
End Function
Return to Macros and VBA Questions
Users browsing this forum: No registered users and 122 guests