Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7590607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:26:36+00:00 2026-05-30T20:26:36+00:00

In Open office I have created a macro for printing documents. sub printDoc(FileName) Dim

  • 0

In Open office I have created a macro for printing documents.

sub printDoc(FileName)
Dim Url as String
Url = convertToUrl(FileName)

Dim Doc as variant
Doc = starDeskTop.loadComponentFromUrl(Url, "_hidden", 0, Array())
Doc.Print(Array())
Doc.Close(True)
End Sub

I call this macro from my c# program, the macro launches and the document prints however the macro errors when it gets to the line “Doc.Close(True)” and sometimes locks up the computer until the program is ended though task manager. Is there something I should be doing differently? Please let me know if you need any additional information.
-Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T20:26:37+00:00Added an answer on May 30, 2026 at 8:26 pm

    Here is what worked (I have an open document function)

    sub printDoc(FileName)
       openDoc(FileName)
    
     Dim opts(0) As New com.sun.star.beans.PropertyValue
     opts(0).Name = "Wait"
     opts(0).Value = True
     thisComponent.Print (opts())
     If HasUnoInterfaces(ThisComponent, "com.sun.star.util.XCloseable") Then 
       ThisComponent.close(true) 
     Else 
       ThisComponent.dispose 
     End If 
    
    End Sub
    

    The important part is:

    Dim opts(0) As New com.sun.star.beans.PropertyValue
    opts(0).Name = "Wait"
    opts(0).Value = True
    thisComponent.Print (opts())
    

    this makes sure we aren’t trying to close the document while we are trying to print it.

    Source:
    http://user.services.openoffice.org/en/forum/viewtopic.php?f=5&t=40719

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the file created within Open Office Calc which I need to load
I know that Open Office Database uses a java database backend. Does anyone have
I have a very simple Office utility question. Open Microsoft word (2003 or 2007),
I've been using the following code to open Office Documents, PDF, etc. on my
I have created some InfoPath forms. I am using MS-Office 2010. I deployed these
I have created a C++ Office 2007/2010 add-in that exposes a custom task pane
Is there a CMS which integrates into Open Office similarly to Share point/MS Office?
Is there anyway to use the Open Office SDK 2.0 to save a PowerPoint
I would like to be able to automate data entry to an Open Office
So i have an image on my computer that has office 2007, and I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.