[Solved] Help with macro [Calc]

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
biggles
Posts: 7
Joined: Fri Jul 14, 2017 12:46 pm

[Solved] Help with macro [Calc]

Post by biggles »

Hi
My macro "saveformas" works fine every time on my windows 10 laptop, but when I copy the spread sheet and macro onto a similar laptops it errors.
"Sub-procedure or function not defined"
Is the macro wrong or have I not enabled something?
As you can see I am a complete novice and would very much appreciate help.

Code: Select all


Sub saveformas

rem ----------------------------------------------------------------------
rem define variables
 dim document   as object
 dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
 document   = ThisComponent.CurrentController.Frame
 dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem------------------
Dim sFileName As String
   Dim sPath As String
   Dim sType as String
   Dim sSaveToURL as string

   
   sPath = "file:///C:/Users/Admin/Desktop/Completed_Forms/"
   sFileName = thisComponent.getSheets.getByName("Sheet1").getCellRangeByName("c7").getString
   sType = ".ods"
   sSaveToURL = ConvertToURL(sPath & sFileName & sType)
   thisComponent.storeToUrl(sSaveToURL, Array(MakePropertyValue("FilterName", "Calc8","FilterType")))

End Sub
Last edited by Hagar Delest on Mon Sep 04, 2017 10:21 pm, edited 3 times in total.
Reason: tagged [Solved].
0pen office 4.1.3 on windows 10
User avatar
robleyd
Moderator
Posts: 5079
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Help with macro

Post by robleyd »

Which line in the code produces the error?

Tip: edit your question and use the Code tags to enclose your macro - this makes it easier to read.
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
User avatar
JohnSUN-Pensioner
Volunteer
Posts: 876
Joined: Fri Jan 14, 2011 1:21 pm
Location: Kyiv, Ukraine

Re: Help with macro

Post by JohnSUN-Pensioner »

Just find on your laptop function MakePropertyValue and copy it with your macro
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
biggles
Posts: 7
Joined: Fri Jul 14, 2017 12:46 pm

Re: Help with macro

Post by biggles »

Thanks for that JohnSUN It seems obvious once someone with a brain gets involved. Thanks once again.
Biggles
0pen office 4.1.3 on windows 10
Post Reply