Word automation and printer spooler document name


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: Word automation and printer spooler document name

  1. #1
    Join Date
    Aug 2009
    Posts
    3

    Word automation and printer spooler document name

    I am developping code to print forms with Word automation. A typical print job will have 20 forms to print in sequence. So to improve performance, we start Word only once, add a new document, update the document, print, close the document and proceed with the next document. Since we dont save the document, when we print, the document has a generic name like "Document2".

    Trying to change the open document name result in a "Read only" error message.
    Is there a way to change the spooler document name. Thanks
    Code:
    FWordApp.Documents.Add(Template:=FDocumentName,NewTemplate:=False);
    FWordApp.Documents.Item(FWordApp.Documents.Count).Activate;
    te;

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Welcome to DevX

    After doing the update, how about doing a SaveAs: and giving each document its on unique name then print and close.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  3. #3
    Join Date
    Aug 2009
    Posts
    3
    That would work, but our software often runs on a file servers, and worse on Citrix servers. Permissions to write temporary files not easy to get from our customers...so it would be difficult. However, I have to admit that several applications do create temporary files, why not ours. I am not too sure where I can ask Windows for a valid temporary file location.

  4. #4
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Well, it sounds like your choices are pretty limited.

    Either stick with the generic file names you have now, or find a spot to do a SaveAs

    Is it a customer that is complaining about the generic Document1, Document2, etc file names?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  5. #5
    Join Date
    Aug 2009
    Posts
    3
    Its just me who is trying to finish this programming right. I will investiguate the SaveAs. Thanks.

  6. #6
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    I don't see why someone would have a problem giving you some temp space with the proviso that you keep it cleaned up.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  7. #7
    Join Date
    Feb 2004
    Location
    Longueuil, Québec
    Posts
    577
    Unless it has been blocked by administrators, your application can generally write with confidence to the ApplicationData directory, which you can retrieve with

    Code:
    system.Environment.GetFolderPath (System.Environment.SpecialFolder.ApplicationData)
    You might also try with some of the other folders listed through the SpecialFolder enumeration.

    Another avenue would be to use Isolated Storage (look it up in MSDN) which is also usually opened for use.
    Jacques Bourgeois
    JBFI
    http://www3.sympatico.ca/jbfi/homeus.htm

Similar Threads

  1. Word Automation with ASP
    By Stan Brown in forum ASP.NET
    Replies: 4
    Last Post: 02-13-2010, 08:49 AM
  2. HELP!! uncovering hidden dialog box
    By TC in forum VB Classic
    Replies: 14
    Last Post: 10-04-2000, 03:42 AM
  3. Printer API's
    By Ryan in forum VB Classic
    Replies: 16
    Last Post: 05-22-2000, 05:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center