+ Reply to Thread
Results 1 to 3 of 3

Print word doc from excel with wildcards on another partition.

  1. #1
    Registered User
    Join Date
    12-08-2011
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2002
    Posts
    10

    Print word doc from excel with wildcards on another partition.

    Hi all,

    I'm trying to write some code so that the user can enter a material number and print out and log sheet made in Excel. (the easy part) But I also wanted to have an option to be able to print out a procedure (word doc) as well. (the hard part)

    The issue I have is that the doc name may change but it will always have the material number as part of the name.

    I borrowed some code from another post and came up with what's below. It works for the most part. It will find the file name with the wildcard.

    The problem I'm having is that it keeps looking at the C:\ drive instead of our network drive (g:\) when it tries to open it up in word.

    How can I get it to look at the full path?

    Eventually, I will not have the message box or word visible. I would like it just to print the doc file in the background.


    Please Login or Register  to view this content.

    Thanks in advance,

    Randy

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Print word doc from excel with wildcards on another partition.

    Try something like this. Set the path in a variable and use it in both the Dir function and to open the doc file.

    Please Login or Register  to view this content.
    EDIT:
    Note: the While-Wend will loop the Dir function until file_name is blank. So this wont open a file because of the that loop. I not sure what you want to do with the loop.
    Last edited by AlphaFrog; 10-11-2013 at 08:51 PM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    12-08-2011
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2002
    Posts
    10

    Re: Print word doc from excel with wildcards on another partition.

    Thanks!

    Took out the while wend and the code worked perfectly! Now I just have to have it print in the background and I'm good to go.

    Greatly apprectiate it and repped!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Windows 7 :Split/Partition C Drive
    By arlu1201 in forum Microsoft Windows Help
    Replies: 7
    Last Post: 04-19-2013, 04:32 AM
  2. [SOLVED] excel * word won't print
    By Cimarron in forum Excel General
    Replies: 0
    Last Post: 05-30-2006, 05:10 PM
  3. Replies: 5
    Last Post: 04-06-2006, 09:50 AM
  4. Replies: 1
    Last Post: 11-02-2005, 06:17 PM
  5. [SOLVED] how to format ntfs partition
    By Zubair Alam in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 04-29-2005, 06:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1