Find first empty row

Thank you Lupp. I will have a look at these approaches.

Forgot…I have Marcos on a hidden sheet to be copy to a Module. I was having trouble copying file and opening on other computers, that seem to fix it. ??

Lupp, I have done some testing on the sample you sent with the two buttons.

Within my multi-sheet file, when the macros are run they jump to the first sheet in the file.

I tried adjusting the pSheetN =1 setting to control the page I land on but get an error. Also, I am having trouble deciphering how the target cell is being defined. Both macros currently land in the “m” column of he sheet being redirected to.

I tried oDoc2 = thisComponent.getSheets and some other functions but couldn’t get anything to load the Summary.ods spreadsheet. I was 99.9% sure the path name would not do it by itself, I just happened to leave it in the sample, that’s why it was commented out.

Now:

oDoc1 = Thiscomponent
oDoc2 = StarDesktop.LoadComponentFromURL(ConvertToURL(fN),"_blank",0,Array())
fN = "c:\Summary.ods"

It produces:
runtime error. Unsupported URL

Summary.ods is in root of C

Did you really assign the string constant to fN after calling LoadComponentFromURL() with fN inside?

I Did. Duh…

Now:

oDoc1 = Thiscomponent
fN = "C:\Summary.ods"
oDoc2 = StarDesktop.LoadComponentFromURL(ConvertToURL(fN),"_blank",0,Array())

Calling out this line “Object variable not set.”

rng = oDoc2.Sheets(0).getCellRangeByName("A1")

Sorry! I cannot confirm this behaviour. My examples work as expected.
One guess: If the file was already opened and, playing with the Sub, you open it a second time you get a respective message. There is also the offer to work on a copy instead of on the document itself. If you accept that offer your oDoc2 is gone. That should be expected.

Lupp, Are you saying you ran the macro using the code in this post and it worked? I will try setting up with bare bones files for both documents to see if presents the same problem. Is this what you meant by “work on a copy” instead of the document itself?

Can you explain how the .Sheets impacts this line rng = oDoc2.Sheets(0).getCellRangeByName("A1") if it is declared as Dim Sheets should this suffice? It isn’t causing the “object variable not set” message is it?

I feel puzzled know. Thought my statements were clear.
“… you ran the macro using the code in this post and it worked?” Yes. This regarding the reserve that I didn’t create a file Summary.ods in the root of my file system. I worked with a file in a standard path for my everyday work. I would expect you also need administrator privileges to place an ordinary file in C:\, and opening it later may bring up the “work on a copy” offer.

Lupp, Didn’t mean to puzzle you. Just wanted to make sure I was understanding before spending even more time trying to get this to work. What your reaffirming has done for me is I know it works if you ran it with success. I will continue to look at things to see if I can breath life into it.

Moved the file out of the root into a folder. Now it’s calling out an unsupported URL. I triple checked the path and the path it’s calling out (below) in the error message appears to be a proper path for Windows

`Message: Unsupported URL <file:///c:/Users/computer%20one/My%20Documents/Summary.ods>: "type detection failed".`

The space encoding %20 shouldn’t be a problem should it?

Also used a blank/fresh Summary.ods spreadsheet being copy/pasted to from the main.ods spreadsheet.

I cannot reproduce anyone of the errors. The first time in my life I even created a folder with one of those silly names containing a space. No chance: No error.
This is getting really annoying. I have to leave the thread.

Lupp, Thank you for your time.

Sorry you became annoyed, that was not the intent. I came to this forum to resolve a legitimate problem.
As for windows putting spaces in a path I don’t know why they do such silly things. It’s Windows. Again, I asked about the spaces to be sure no stone was being left unturned; no other reason.

If anyone else could jump in to provide insight on something that might be causing this I would appreciate it. Thank you.

Sorry. I’m not a native speaker of English and may have used a term in the wrong way. The “annoying” didn’t aim at you but at the strange situation I couldn’t manage. How to handle errors I never saw with my own eyes? Concerning spaces in pathnames: Yes they are coded the html way. I’m on Win, too, and have to accept a few paths containing spaces, in specific the extruciating ‘program files’. I never give a name of the kind to one of my files and Win doesn’t force me.

Your questions are legitimate, of course. However, the current discussion is very far off the original question of this thread. To get new attention for your current problems with opening secondary spreadsheet documents and with using ranges in these documents, you should open a new thread and post the few relevant lines of code.
I personally never had a similar problem under Win 10 with many different versions of LibO and AOO. Did you read Pitonyak meanwhile?

Lupp. Thank your for your reply.

Actually I have been reading the Pitonyak pubs. This approach actually came from “OpenOffice.org Macros Explained” page 497. This is not something I’ve attempted in 5 minutes of my time and immediately went to the forum. I have been digging for weeks looking for the content I need to accomplish this. I came to the forum after doing much due diligence hoping someone could help.

Ran out of characters and will post another comment to continue.

I was originally thinking about posting a new thread but decided to stay with the current thread since it all is part of what I am trying to accomplish. This was apparently a bad decision on my part. I was actually thinking of the overall community when I made this decision so they would have the whole package along with myself. Thinking of others gets me in trouble.

But with your suggestion I will do so.

Thanks again Lupp. Have a nice day. I appreciate it.

One last thing. I am on Windows 7 Pro with LibreOffice 5.2.

Hope you will have success with your next question. And if I get a new idea , I won’t hide it from you.

Hi Lupp. I need to share this with you since you have been such a hugh help and I don’t want you’re expertise and contributions to go unnoticed.

I stepped away from this for awhile and came back to it with a clearer mind today. It was obvious the macro did not like the URL, the error message was clear on that. Didn’t have the presence of mind yesterday to go to the file and get the windows path by shift/right-click and copy. At comment limit and will add another comment.