File name saved as customers name?

Discuss the word processor
Post Reply
latour228
Posts: 28
Joined: Mon Jan 18, 2021 9:46 pm

File name saved as customers name?

Post by latour228 »

I don't know if this is even possible. But was wondering if there was a way to make it recognize what the name of a document should be called, when a cell is filled out? Like for instance, I have a table/order form created... But when I go into it to fill it out, I'd like to to save the file in the name of the order like for instance "name of customer"...

I'm not sure if someone else has asked this or not, wasn't even sure how to look something like this up as I don't know what it would be called if it is possible.

Thanks for any help. :)
Apache OpenOffice 4.1.7
Windows 10
JeJe
Volunteer
Posts: 2763
Joined: Wed Mar 09, 2016 2:40 pm

Re: file name saved as customers name?

Post by JeJe »

What exactly are you asking for? Its

ctrl + a in a table cell to select the text
ctrl + c to copy
ctrl + shift + s to open the save as dialog
ctrl + v to paste.

Or you can write a macro to save the file instead?
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
latour228
Posts: 28
Joined: Mon Jan 18, 2021 9:46 pm

Re: File name saved as customers name?

Post by latour228 »

So sorry it took so long to get back with you. I apologize! Life got away from me.

I know I can do the copy and paste method. But I was hoping it would just automatically put the customers name in as the file name when I got to save it. If that makes sense?

How would I go about writing a macro?

Thanks
Apache OpenOffice 4.1.7
Windows 10
User avatar
RoryOF
Moderator
Posts: 34586
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: File name saved as customers name?

Post by RoryOF »

To write a simple macro you would need to read the AOO BASIC manual. To do anything more complex you should study the works of Andrew Pitonyak on AOO macros. Excellent as these works are, I suggest you don't write a macro - there may be better uses of your time than studying computing languages to save yourself four clicks on starting a file for your requirements.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: File name saved as customers name?

Post by Villeroy »

And don''t forget to handle the case where a file with that name already exists. Could be that you overwrite information about the same client or some other client with the same name.
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
JeJe
Volunteer
Posts: 2763
Joined: Wed Mar 09, 2016 2:40 pm

Re: File name saved as customers name?

Post by JeJe »

Something like this if the cell with the customer's name is the selection.

Note: not thoroughly tested/error checked... there may be all kinds of unforeseen circumstances where something goes wrong with this macro.

Code: Select all

Sub SaveFileSameNameAsCurrentCell

doc =  thiscomponent
filename = doc.currentselection.string 'what's in your cell
path = "C:\tmp\" 'example change this to your wanted path
url = ConvertToURL(path & filename & ".ods")
if dir(url)<>"" then 'check if the file already exists
'if it does decide what you want to do here

else
Doc.StoreAsURL(url,Array()) 'save it
end if

End Sub
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
latour228
Posts: 28
Joined: Mon Jan 18, 2021 9:46 pm

Re: File name saved as customers name?

Post by latour228 »

Yeah macros is way out of my element. Ha! I was just hoping there would be a simple fix.

Thanks! :)
Apache OpenOffice 4.1.7
Windows 10
User avatar
RoryOF
Moderator
Posts: 34586
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: File name saved as customers name?

Post by RoryOF »

New Users are usually not aware that macros are written in a language, and although there are not many words in the language, it has a complex grammar, which requires study.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
latour228
Posts: 28
Joined: Mon Jan 18, 2021 9:46 pm

Re: File name saved as customers name?

Post by latour228 »

Yeah, I wouldn't even know where to begin. I was just hoping it would be some kind of setting somewhere within the software. But that's okay. Just afraid that something is going to happen if I do something wrong. Ha
Apache OpenOffice 4.1.7
Windows 10
Post Reply