How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask Michael Hannigan Your Own Question

Michael Hannigan
Michael Hannigan, Office Specialist
Category: Microsoft Office
Satisfied Customers: 8180
Experience:  20+ Years Experience in Field. MCSE, ICCP, CNE, Greenbelt
23511658
Type Your Microsoft Office Question Here...
Michael Hannigan is online now
A new question is answered every 9 seconds

I need a macro that will search this folder D:\new sws folder\maintena

Resolved Question:

I need a macro that will search this folder D:\new sws folder\maintenance\poreq for all excel files that have a date that I input all the file names are XXXXX XXXXX PO-otp-5-6-13, the 5-6-13 is the date I need it looked up by then when all the files have been found I need it to print them and close the files
Can this be done
Help I have no idea where to start
Submitted: 1 year ago.
Category: Microsoft Office
Expert:  Michael Hannigan replied 1 year ago.
Hello. My name is Michael. I can help you wiht your question.

Ideally, would this be a macro that woudl run from Excel, or would you be developing it to run outside of Excel?

Mike
Customer: replied 1 year ago.


from inside excel off of a button on the form

Expert:  Michael Hannigan replied 1 year ago.
Ok, Ken. I'm going to work on this for you. Ideally, I can provide you with some simple code you can use.

Mike
Expert:  Michael Hannigan replied 1 year ago.

Ken, I have the basic macro for you. Currently, it will take your input from the input box and search the path for that string and print those that match.

Sub Batch_Print()
Dim Input_Dir, Print_File As String
Input_Dir = InputBox _
("Input directory path containing the files to print")
' Defines Print_File equal to the first Microsoft Excel file found
' in the directory specified in the InputBox above.
Print_File = Dir("D:\new sws folder\maintenance\poreq\*"&Input_Dir & "*.xl*")

' If you are using Microsoft Excel for the Macintosh, you need
' to change Print_File = Dir(Input_Dir & "' .xl*") to
'
' If you are using Microsoft Excel 5.0, use this line
' Print_File = Dir(Input_Dir & ":", MacID("XLS5"))
'
' If you are using Microsoft Excel 98, use this line
' Print_File = Dir(Input_Dir & ":", MacID("XLS8"))
'
' and change Workbooks.Open Filename:=Input_Dir & "\" & Print_File
' to:
'
' Workbooks.Open Filename:=Input_Dir & ":" & Print_File

' Loops through the directory specified in the above InputBox
' and opens each workbook in the directory, prints all sheets
' in the workbook and closes the workbook. Continues until are
' all files are printed.
Do While Len(Print_File) > 0
Workbooks.Open Filename:=Print_File
ActiveWorkbook.PrintOut Copies:=1
ActiveWorkbook.Close
Print_File = Dir()
Loop
End Sub

Customer: replied 1 year ago.


Its giving me a error message it says


 


Run-time error '1004':


'PO-kenm-3170-5-5-13 could not be found check the spelling of the file name and verify that the file location is correct.


 


If you are trying to open the file from your list of most recently used files, make sure that the file has not been renamed, moved or deleted


 


I verified the file name and location and even opened it manualy

Customer: replied 1 year ago.

I am using windows 7, office 2010

Expert:  Michael Hannigan replied 1 year ago.
Ken... just need a few minutes to look at the problem.

Mike
Expert:  replied 1 year ago.
Ken, it looks like it finds the files, but then when it tries to print, I didn't have the path in the file name. So change
Workbooks.Open Filename:=Print_File
to
Workbooks.Open Filename:="D:\new sws folder\maintenance\poreq\"&Print_File

This should provide the basic functionality you are looking for.

Mike
Michael Hannigan, Office Specialist
Category: Microsoft Office
Satisfied Customers: 8180
Experience: 20+ Years Experience in Field. MCSE, ICCP, CNE, Greenbelt
Michael Hannigan and 5 other Microsoft Office Specialists are ready to help you
Customer: replied 1 year ago.


Thanks a lot that seems to be doing it

Customer: replied 1 year ago.


My question page says im still waiting for a response from the pro did I not close this out correctly you did a awesome job and would like to make sure I did what I needed to on my end for you

Expert:  Michael Hannigan replied 1 year ago.

You did, Ken. Thank you very much! And thank you for the compliment!

 

It was a pleasure working with you!

 

Mike

JustAnswer in the News:

 
 
 
Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.
 
 
 

What Customers are Saying:

 
 
 
  • My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed. One Happy Customer New York
< Last | Next >
  • My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed. One Happy Customer New York
  • Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
  • This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!! Alex Los Angeles, CA
  • Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult. GP Hesperia, CA
  • I couldn't be more satisfied! This is the site I will always come to when I need a second opinion. Justin Kernersville, NC
  • Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around. Esther Woodstock, NY
  • Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know. Robin Elkton, Maryland
 
 
 

Meet The Experts:

 
 
 
  • jstinehelfer

    Information Systems Manager

    Satisfied Customers:

    36
    A+ Comptia Certified computer repair
< Last | Next >
  • http://ww2.justanswer.com/uploads/JS/jstinehelfer/2012-6-6_215146_Pictureofme1.64x64.png jstinehelfer's Avatar

    jstinehelfer

    Information Systems Manager

    Satisfied Customers:

    36
    A+ Comptia Certified computer repair
  • http://ww2.justanswer.com/uploads/JA/JasonJames122/2011-12-16_135647_jasonjamesheadshotweb.64x64.jpg JasonJames122's Avatar

    JasonJames122

    Computer Enthusiast

    Satisfied Customers:

    0
    I manage all information systems (network of Windows PC's and servers with Microsoft Office products) for a small business
  • http://ww2.justanswer.com/uploads/JE/jessmagz/2012-6-6_18129_jm.64x64.jpg Jess M.'s Avatar

    Jess M.

    Computer Support Specialist

    Satisfied Customers:

    301
    Computer Software Specialist for more than 10 years
  • http://ww2.justanswer.com/uploads/CH/chutz747/2011-11-6_14231_me.64x64.jpg The-PC-Guy's Avatar

    The-PC-Guy

    Computer Manager

    Satisfied Customers:

    274
    20 years experience providing remote computer support
  • http://ww2.justanswer.com/uploads/SP/spherrod/2012-6-6_174244_1000852.64x64.JPG Steve Herrod's Avatar

    Steve Herrod

    Computer Support Specialist

    Satisfied Customers:

    125
    Trained in Microsoft Office from 2000 through to latest version 2010.
  • http://ww2.justanswer.com/uploads/SE/Seashore2011/2011-12-6_33418_111205223015.64x64.jpg Chris L.'s Avatar

    Chris L.

    Support Specialist

    Satisfied Customers:

    124
    Certified Expert with over 10 years experience.
  • http://ww2.justanswer.com/uploads/KR/krkljatorm/2012-6-24_153417_ITMiro.64x64.jpg IT Miro's Avatar

    IT Miro

    Computer Scientist

    Satisfied Customers:

    97
    Bachelor's Degree in Information Technology, Microsoft Certified Professional
 
 
 

Related Microsoft Office Questions