Macro to print documents in the same directory
Macro to print documents in the same directory
Hello.
I'm currently working in OpenOffice Calc, and I often have to print more than 40 files at once. Select all, PCM, printing does not work for me. Tell me, please, can there be a macro that allows you to print all the files in the same folder in which the file is located, where does this macro run from? I used to work in Excel, but at work only OpenOffice is installed, so now I'm working on it. If I know more or less excel macros, then I do not understand anything in OO macros. Help me please.
I'm currently working in OpenOffice Calc, and I often have to print more than 40 files at once. Select all, PCM, printing does not work for me. Tell me, please, can there be a macro that allows you to print all the files in the same folder in which the file is located, where does this macro run from? I used to work in Excel, but at work only OpenOffice is installed, so now I'm working on it. If I know more or less excel macros, then I do not understand anything in OO macros. Help me please.
OpenOffice 3.3.0 on Windows 8.1
- JohnSUN-Pensioner
- Volunteer
- Posts: 876
- Joined: Fri Jan 14, 2011 1:21 pm
- Location: Kyiv, Ukraine
Re: Macro to print documents in the same directory
Not the answer, just a little explanation: when OOKapitan writes "PCM", he meant the right click of the mouse
I may not have a lot to give but what I got I'll give to you...
Apache OpenOffice 4.1.5, LibreOffice 6.4.4.2 (x64) on Windows 7
If you think that I did not answer your question, make allowances for my imperfect English
Apache OpenOffice 4.1.5, LibreOffice 6.4.4.2 (x64) on Windows 7
If you think that I did not answer your question, make allowances for my imperfect English
Re: Macro to print documents in the same directory
So it is not a mystake.JohnSUN-Pensioner wrote:Not the answer, just a little explanation: when OOKapitan writes "PCM", he meant the right click of the mouse
OpenOffice 3.3.0 on Windows 8.1
Re: Macro to print documents in the same directory
This task requires a quite complex macro.If I know more or less excel macros, then I do not understand anything in OO macros.
I suggest you: Hire somebody to write this macro for you.
There is a section of this Forum, named: Paid support.
viewforum.php?f=53
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Macro to print documents in the same directory
Ho is able easilly to write such mscro, please, write me this macros to me.
OpenOffice 3.3.0 on Windows 8.1
Re: Macro to print documents in the same directory
I think this can be done quite easily with a macro at the Operating System level. OpenOfice can take command line arguments, one of which is to print a file or files passed as arguments.
https://wiki.openoffice.org/wiki/Framew ... _Arguments
It should be simple to write a Windows batch file to read a directory, t hen feed each file name into the OO command line until there are no more files left.
https://wiki.openoffice.org/wiki/Framew ... _Arguments
It should be simple to write a Windows batch file to read a directory, t hen feed each file name into the OO command line until there are no more files left.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Re: Macro to print documents in the same directory
These threads may be helpful:
http://www.sobolsoft.com/howtouse/print ... writer.htm
https://wiki.openoffice.org/wiki/Docume ... _in_OOo%3F
http://www.sobolsoft.com/howtouse/print ... writer.htm
https://wiki.openoffice.org/wiki/Docume ... _in_OOo%3F
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Re: Macro to print documents in the same directory
Do, pleaseRoryOF wrote:It should be simple to write a Windows batch file to read a directory, t hen feed each file name into the OO command line until there are no more files left.
OpenOffice 3.3.0 on Windows 8.1
Re: Macro to print documents in the same directory
With respect, you want it, you write it. I don't need to print files in such a way. I've already done some research for you and the process now should now be achievable using your existing skills gained from writing Excel macros,
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Re: Macro to print documents in the same directory
Who can write me the example of the macro?
OpenOffice 3.3.0 on Windows 8.1
Re: Macro to print documents in the same directory
Shell command to send all ODF documents in D:\Data\PrintDocs\ to the default printer:
Same with explicit printer name:
Code: Select all
soffice.exe -p D:\Data\PrintDocs\*.od?
Code: Select all
soffice.exe -pt PrinterName D:\Data\PrintDocs\*.od?
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Macro to print documents in the same directory
all in the derrictory the file with macro is?Villeroy wrote:Shell command to send all ODF documents in D:\Data\PrintDocs\ to the default printer:Same with explicit printer name:Code: Select all
soffice.exe -p D:\Data\PrintDocs\*.od?
Code: Select all
soffice.exe -pt PrinterName D:\Data\PrintDocs\*.od?
PrinterName in
Code: Select all
soffice.exe -pt PrinterName D:\Data\PrintDocs\*.od?
OpenOffice 3.3.0 on Windows 8.1
Re: Macro to print documents in the same directory
You run this from a command prompt - it is not an OpenOffice macro.
Change PrinterName to your printer name only if you do not want to use the default printer.
Change D:\Data\PrintDocs\ to the directory where you keep the files you want to print. If you only want to print Calc spreadsheets, change *od? to *.ods then all the spreadsheets in the directory you have named will be printed.
Code: Select all
soffice.exe -pt PrinterName D:\Data\PrintDocs\*.od?
Change D:\Data\PrintDocs\ to the directory where you keep the files you want to print. If you only want to print Calc spreadsheets, change *od? to *.ods then all the spreadsheets in the directory you have named will be printed.
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
Re: Macro to print documents in the same directory
I understand and will test it. However what about an OpenOffice macro? I am just afraid to crash something on PC at work.
OpenOffice 3.3.0 on Windows 8.1
Re: Macro to print documents in the same directory
You are more likely to crash something using a macro.
Make a small test directory with two or three trivial files and try using that.
Make a small test directory with two or three trivial files and try using that.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Re: Macro to print documents in the same directory
Thank you very much.RoryOF wrote:You are more likely to crash something using a macro.
Make a small test directory with two or three trivial files and try using that.
OpenOffice 3.3.0 on Windows 8.1
Re: Macro to print documents in the same directory
May i create a bat file? Will it work? Or only from a command promt?robleyd wrote:You run this from a command prompt
OpenOffice 3.3.0 on Windows 8.1
Re: Macro to print documents in the same directory
Use a .bat file, command prompt or even a shortcut icon.
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
Re: Macro to print documents in the same directory
Start by using a command prompt and a small trial directory; when you have it working then is time to write a .bat file.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Re: Macro to print documents in the same directory
Nevertheless, is anyone able to write the macro?
OpenOffice 3.3.0 on Windows 8.1
Re: Macro to print documents in the same directory
sample code snippets:
viewtopic.php?t=41231
https://www.xml.com/pub/a/2006/01/11/fr ... ffice.html
viewtopic.php?f=20&t=73807
viewtopic.php?f=20&t=25840
viewtopic.php?f=21&t=56713
viewtopic.php?t=41231
https://www.xml.com/pub/a/2006/01/11/fr ... ffice.html
viewtopic.php?f=20&t=73807
viewtopic.php?f=20&t=25840
viewtopic.php?f=21&t=56713
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Macro to print documents in the same directory
Is anyone able to give me an I read a bit the links a post before, however I do something wrong when triing to adaptate the codes to my need.
OpenOffice 3.3.0 on Windows 8.1
Re: Macro to print documents in the same directory
Please upload your .ODF type file with the embedded macro code that you wrote.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Macro to print documents in the same directory
Here's what I got.
But:
1) it prints out from the directory c:\printpath, but I would like the macro to let me select a folder or to print out from the same folder the macro is in (to select the folder would be better);
2) after each document asks whether it is printed or not, but I would like the macro after selecting a folder just to print all files in it.
Also it would be better if the macro could print only files with the extension xls.
Help me please.
But:
1) it prints out from the directory c:\printpath, but I would like the macro to let me select a folder or to print out from the same folder the macro is in (to select the folder would be better);
2) after each document asks whether it is printed or not, but I would like the macro after selecting a folder just to print all files in it.
Also it would be better if the macro could print only files with the extension xls.
Help me please.
- Attachments
-
- Печать из заданной папки.odt
- (20.31 KiB) Downloaded 282 times
OpenOffice 3.3.0 on Windows 8.1
Re: Macro to print documents in the same directory
The code snippet on the linked page contains: how you can select a specific directory:1) it prints out from the directory c:\printpath, but I would like the macro to let me select a folder or to print out from the same folder the macro is in (to select the folder would be better);
Code: Select all
...
Dim sPath
sPath = getFolder("Please select a folder") & GetPathSeparator()
...
Function getFolder(sTitle AS String, optional sInitDir) AS String
oPicker = CreateUnoService("com.sun.star.ui.dialogs.FolderPicker")
oPicker.setTitle(sTitle)
if not ismissing(sInitDir) then oPicker.setDisplayDirectory(sInitDir)
if oPicker.execute() then getFolder = oPicker.getDirectory()
End Function
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Macro to print documents in the same directory
I tried. The macro allowes me to select the folder, but prints nothing. I forgot to say that the files must be opened visibly or they won't be printed.
OpenOffice 3.3.0 on Windows 8.1
Re: Macro to print documents in the same directory
Really, the usage of the filepicker is only the first part of the full macro what you needed. Then you must open (LoadFromURL...) the documents one by one (silently or visible) based on the picked path and the DIR strings as filenames, and then you will able to use the Print command of the API.I tried. The macro allowes me to select the folder, but prints nothing. I forgot to say that the files must be opened visibly or they won't be printed.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Macro to print documents in the same directory
I do not no how to do this. Macro on the OpenOffice is a forest to me. I managed to write the macro I inserted two posts above by using parts of macro I found in the internet. In excel to write macro I in minimum just need to understand english. For macro in OpenOffice it doesn't work. Please help me to write full macro.Zizi64 wrote:Really, the usage of the filepicker is only the first part of the full macro what you needed. Then you must open (LoadFromURL...) the documents one by one (silently or visible) based on the picked path and the DIR strings as filenames, and then you will able to use the Print command of the API.I tried. The macro allowes me to select the folder, but prints nothing. I forgot to say that the files must be opened visibly or they won't be printed.
OpenOffice 3.3.0 on Windows 8.1
Re: Macro to print documents in the same directory
Read and study Andrew Pitonyak's free macro books:Please help me to write full macro.
http://www.pitonyak.org/oo.php
The forum is not a free macro writing service.
Try to write a macro, upload the working example here, and we will (try to) fix your mistakes.
Try the LibreOffice. It has a higher compatibility with the foreign fileformats and the MS VBA macros.In excel to write macro I in minimum just need to understand english. For macro in OpenOffice it doesn't work.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.