Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
GFN GFN is offline
external usenet poster
 
Posts: 8
Default Macro won't run from d: drive, but works on c: drive

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Macro won't run from d: drive, but works on c: drive

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   Report Post  
Posted to microsoft.public.excel.programming
GFN GFN is offline
external usenet poster
 
Posts: 8
Default Macro won't run from d: drive, but works on c: drive

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Macro won't run from d: drive, but works on c: drive

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro won't run from d: drive, but works on c: drive


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   Report Post  
Posted to microsoft.public.excel.programming
GFN GFN is offline
external usenet poster
 
Posts: 8
Default Macro won't run from d: drive, but works on c: drive

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
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
Links to mapped drive change to refer to local hard drive SueD Links and Linking in Excel 1 May 8th 08 11:42 AM
Can I save to hard drive AND my flash drive at the same time? Gizelle Excel Discussion (Misc queries) 3 July 24th 06 08:27 PM
Userform Local Drive & Network drive question Joel Mills Excel Programming 3 December 29th 04 10:43 PM
Pasting a range of information from a foler on F Drive to another folder on same drive Tom Ogilvy Excel Programming 1 August 3rd 03 01:50 AM
Find links with code; change from G drive to C drive Sandy[_3_] Excel Programming 4 July 26th 03 07:24 PM


All times are GMT +1. The time now is 06:14 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"