[Solved] Help with macro [Calc]

Creating a macro - Writing a Script - Using the API

[Solved] Help with macro [Calc]

Postby biggles » Mon Aug 28, 2017 10:37 am

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   Expand viewCollapse view

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
biggles
 
Posts: 7
Joined: Fri Jul 14, 2017 12:46 pm

Re: Help with macro

Postby robleyd » Mon Aug 28, 2017 10:44 am

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
Apache OpenOffice Developer Build 4.2.0 9820 - Slackware 14.2 - 64 bit
LibreOffice 6.0.7.3 - Slackware 14.2 - 64 bit
Apache OpenOffice 4.1.4 - Windows 7 Virtual machine
User avatar
robleyd
Moderator
 
Posts: 2733
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Help with macro

Postby JohnSUN-Pensioner » Mon Aug 28, 2017 10:44 am

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.4, LibreOffice 5.4.2.2 (x64) on Windows 7
If you think that I did not answer your question, make allowances for my imperfect English
User avatar
JohnSUN-Pensioner
Volunteer
 
Posts: 761
Joined: Fri Jan 14, 2011 1:21 pm
Location: Kyiv, Ukraine

Re: Help with macro

Postby biggles » Tue Aug 29, 2017 6:52 pm

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
biggles
 
Posts: 7
Joined: Fri Jul 14, 2017 12:46 pm


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 5 guests