Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a macro that looks for pdf files from within the directory where the
active excel file is. It works when the excel file is on the desktop, but it doesn't work when moved to the d: drive. I've tried it on another computer and it works where ever I put the excel file. Is there a setting that I need to fix in order for it to run. GFN. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
GFN,
Is D: a CD ? Also "it doesn't work" means what ? NickHK "GFN" wrote in message ... I have a macro that looks for pdf files from within the directory where the active excel file is. It works when the excel file is on the desktop, but it doesn't work when moved to the d: drive. I've tried it on another computer and it works where ever I put the excel file. Is there a setting that I need to fix in order for it to run. GFN. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
No, it's a hard drive.
"NickHK" wrote: GFN, Is D: a CD ? Also "it doesn't work" means what ? NickHK "GFN" wrote in message ... I have a macro that looks for pdf files from within the directory where the active excel file is. It works when the excel file is on the desktop, but it doesn't work when moved to the d: drive. I've tried it on another computer and it works where ever I put the excel file. Is there a setting that I need to fix in order for it to run. GFN. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
GFN,
OK, but what does "it doesn't work" mean ? A few more details would help. NickHK "GFN" wrote in message ... No, it's a hard drive. "NickHK" wrote: GFN, Is D: a CD ? Also "it doesn't work" means what ? NickHK "GFN" wrote in message ... I have a macro that looks for pdf files from within the directory where the active excel file is. It works when the excel file is on the desktop, but it doesn't work when moved to the d: drive. I've tried it on another computer and it works where ever I put the excel file. Is there a setting that I need to fix in order for it to run. GFN. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Post your code please.. -- Kaa ----------------------------------------------------------------------- Kaak's Profile: http://www.excelforum.com/member.php...nfo&userid=751 View this thread: http://www.excelforum.com/showthread.php?threadid=39114 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The code is below. I am having problems when it gets to the .filesearch
part. It is now writing the headings and the last part that tells the number of files found, but it's not doing the .filesearch function. Sub ListPDFs() 'This Macro lists the pdf files in the current directory 'including the subdirectories 'Clear out all cell in the sheet Cells.Clear 'Add headings Worksheets("Directory").Activate Cells.Clear With ActiveSheet.Range("A1:d1") .Value = Array("Filename", "Size", "Date/Time", "Path") .Font.Bold = True End With test = CurDir 'Search for pdf files in current directory With Application.FileSearch .NewSearch .LookIn = CurDir .SearchSubFolders = True .Filename = "*.pdf" .Execute NumberOfFiles = .FoundFiles.Count Row = 1 Application.ScreenUpdating = True For i = 1 To .FoundFiles.Count Application.StatusBar = "Working on " & (i) & " of " & NumberOfFiles Row = Row + 1 'Puts file names, sizes, and dates, and path into row CurrentEntry = .FoundFiles(i) For j = Len(CurrentEntry) To 1 Step -1 If Mid(CurrentEntry, j, 1) = Application.PathSeparator Then Cells(Row, 1) = Mid(CurrentEntry, j + 1) Exit For End If Next j Cells(Row, 2) = FileLen(CurrentEntry) Cells(Row, 3) = FileDateTime(CurrentEntry) Cells(Row, 4) = CurrentEntry On Error Resume Next Next i End With ActiveSheet.UsedRange.Name = "FileList" With Cells(Row + 2, 1) .Value = "There are " & FormatNumber(FilesToProcess, 0, vbFalse, vbFalse, vbTrue) & " PDF files in the current directory." .Font.Bold = True End With Cells(Row + 3, 1) = test Application.StatusBar = False End Sub "Kaak" wrote: Post your code please... -- Kaak ------------------------------------------------------------------------ Kaak's Profile: http://www.excelforum.com/member.php...fo&userid=7513 View this thread: http://www.excelforum.com/showthread...hreadid=391143 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Links to mapped drive change to refer to local hard drive | Links and Linking in Excel | |||
Can I save to hard drive AND my flash drive at the same time? | Excel Discussion (Misc queries) | |||
Userform Local Drive & Network drive question | Excel Programming | |||
Pasting a range of information from a foler on F Drive to another folder on same drive | Excel Programming | |||
Find links with code; change from G drive to C drive | Excel Programming |