View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Derek Johansen[_2_] Derek Johansen[_2_] is offline
external usenet poster
 
Posts: 41
Default Recursive Sub Routine?

I have a question for you gurus out there!

I have a macro to import a text file, run some code and basically assign
item numbers to each part of sheet based on different cells values. When
first run, the macro prompts for a job number, and then creates a directory
for this job number. Because each job has multiple text files, at the end of
each run of the subroutine, i'm calling the "WallsPlus()" sub routine again.
The thing is, I don't want the user to be prompted to have to type in a job
number for every single text file (Sometimes 50+)

I have two ideas, neither of which I know how to implement.

1. I wanted to setup If strJobNumber = "" then prompt for the job number...
if strJobNumber < "" then don't ask for a job number. The problem here, i
believe, is that when the sub routine is recalled, the previous strJobNumber
is erased and is always set to ""

2. Import all the text files in one go. I don't see how this is a huge
possibility, simply because every way i have tried to import a new text file,
it opens a new workbook. And to create a macro to copy and paste a new
workbook into a previous workbook an unknown number of times seems rather
difficult and necessary.

If anyone has any ideas on how I can implement either of these solutions,
let me know, and if you want to see my code (although very crude, but working
none-the-less) let me know!

Thanks,

Derek