Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Below is a subset of some code that I have for a macro that opens and prints
files in a specific directory on a users C:\drive. The macro first counts the files then opens them and prints the applicable pages. Everything work fine unless a user has Tools-Option-General-Default File Location set to anything other than the C:\drive (If it is set to the C:\drive, the directory within the C:\drive doesn't seem to matter). If I set a watch on directoryname it shows "C:\ProPupload\Do", but exits the count routine after the first pass if there are no files in the non C:\drive default file location, or the code bombs if there are files in the non C:\drive default file location. Is there something else I need to add to make sure that the pointer gets re directed to C:\? Any help is greatly appreciated. Sub aaaOpenandPrint() Dim result As Integer Dim noOfFiles As Integer Dim arrayFiles() As String Dim name_text As String Dim count As Integer Dim f As String 'define the location of the boe Do files directoryname = "C:\ProPupload\Do\" 'get a list of the files to process in the DO folder ChDir directoryname count = 0 f = Dir$("*") Do While Len(f) 0 count = count + 1 ReDim Preserve arrayFiles(1 To count) arrayFiles(count) = f f = Dir$() Loop noOfFiles = count '--------------------------------------------------------------------- 'open one file at a time and format the report ' count = 1 Do While count < noOfFiles + 1 Workbooks.Open Filename:=arrayFiles(count) printfilename = arrayFiles(count) count = count + 1 'Start printing Windows(printfilename).Activate -- Thanks, Lee |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Default file location | Excel Discussion (Misc queries) | |||
Default file location | Setting up and Configuration of Excel | |||
default file location | Excel Discussion (Misc queries) | |||
Add a default location for print to file in Excel. | Excel Discussion (Misc queries) | |||
Default File Location | Excel Programming |