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