[Solved] Values changed by macro changed to zero on reopen.

Discuss the word processor
Post Reply
KAOS
Posts: 6
Joined: Fri Jul 21, 2017 6:52 pm

[Solved] Values changed by macro changed to zero on reopen.

Post by KAOS »

Hi again,
I have a problem. I have few tables in my Writer file and I do some changes to columns by a macro and save them. I close the document (manually) and open it again. Values I changed manually are properly saved but those changed by macro are zeroized. Not unsaved, just all changed to zero. And they were perfectly fine before and after I pressed "save" button. It happens upon reopening of document. My guess is, that cause is some document change protection, I just don't know which one. I know it is not fault of macro itself, because it used to work fine. My boss probably did some changes on security of document and I don't know what changes. But it could be something else too... I have to somehow remove his admin rights in the future :roll: - any ideas what could be changed in the document?
Thanks for help.
Last edited by KAOS on Wed Aug 30, 2017 8:52 pm, edited 1 time in total.
OpenOffice 4.1.3
Windows 10
jrkrideau
Volunteer
Posts: 3816
Joined: Sun Dec 30, 2007 10:00 pm
Location: Kingston Ontario Canada

Re: Values changed by macro changed to zero upon re-opening

Post by jrkrideau »

Can you upload an example file. You can replace any actual numbers with made-up data if the actual data is confidential.

To upload there is an upload tab at the bottom of the "reply" and "quote" windows.
LibreOffice 7.3.7. 2; Ubuntu 22.04
John_Ha
Volunteer
Posts: 9584
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Values changed by macro changed to zero upon re-opening

Post by John_Ha »

It would be useful if you could post the macro code as well.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
KAOS
Posts: 6
Joined: Fri Jul 21, 2017 6:52 pm

Re: Values changed by macro changed to zero upon re-opening

Post by KAOS »

My macro does not much. It is activated by pressing the only button in form. It only finds some text in text file and input them into columns on first page and then it fills table on the last page. It adds "hours online" which is single row table and the last thing is it checks one line and give you a beep and a message in case it is wrong. It is my first macro ever and I know now, that there are better ways how to achieve the same but it was working so why change it... I tried to connect macro within form, so you should be able to see it inside too.
[FILE REMOVED]
Last edited by KAOS on Thu Aug 31, 2017 3:22 pm, edited 1 time in total.
OpenOffice 4.1.3
Windows 10
John_Ha
Volunteer
Posts: 9584
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Values changed by macro changed to zero upon re-opening

Post by John_Ha »

Can you please also upload the text file so that the macro will run. Rename it xxx.zip if necessary to upload it, or upload the text as Code.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
KAOS
Posts: 6
Joined: Fri Jul 21, 2017 6:52 pm

Re: Values changed by macro changed to zero upon re-opening

Post by KAOS »

I removed all the sensitive stuff from .dat file but it should work fine.
[FILE REMOVED]
Last edited by KAOS on Thu Aug 31, 2017 3:22 pm, edited 2 times in total.
OpenOffice 4.1.3
Windows 10
KAOS
Posts: 6
Joined: Fri Jul 21, 2017 6:52 pm

Re: Values changed by macro changed to zero upon re-opening

Post by KAOS »

I solved it finally. Problem was that those values are all beginning with " " space. Columns were formated (automatically by content) as a number. If you take any string beginning with " " and convert it to integer it becomes "0" and that is exactly what happened when I wanted to open the file. So now are all the fields strictly manually set to text and I can close this topic.
OpenOffice 4.1.3
Windows 10
Post Reply