Page 1 of 1

[Dropped] File saved to flash drive gives Disk Locked error

Posted: Fri Apr 25, 2025 4:30 pm
by alf50
File Saved to FlashDrive gives Disk Locked Error. ...(document, "uno:SaveAs", "", 0, args(2)) Method used.

Also tried FileSave() command, but apparently that only works with LibreOffice, not OpenOffice.

Also tried reformatting the Flash drive to MS-DOS FAT(32) format because I must share this x.ods file with pc users. Can drag and drop the file to the flash drive without issue, but using the macro generates the error.

The Code "Snippet" is shown below.

Code: Select all

	if CNT = "1" then
		msg = "Insert Transfer Flash Drive in USB port(F:)" & CHR(10)
		msg = msg & "then Click OK button Or Press Enter Key."
		msgbox msg
		dim args2(1) as new com.sun.star.beans.PropertyValue
		args2(0).Name = "URL"
		args2(0).Value = RSCINDrv & "/" & A
		args2(1).Name = "FilterName"
		args2(1).Value = "calc8"
		dispatcher.executeDispatch(document, ".uno:SaveAs", "", 0, args2())
		goto BC2:	
	end if

Re: File saved to FlashDrive using macro gives Disk Locked error

Posted: Fri Apr 25, 2025 11:36 pm
by JeJe
Try using converttourl for args2(0).Value

Edit: I assume RSCINDrv and A are defined string variables

Edit2: If your path is defined properly and it works with saving to the hard drive but not the USB, you could try saving to the hard drive then using FileCopy to transfer it and see if that works, noting that you can only use the FileCopy statement to copy files that are not opened.

Re: File saved to FlashDrive using macro gives Disk Locked error

Posted: Sat Apr 26, 2025 11:18 pm
by alf50
JeJe,
I can save the file to my hard drive just fine. But when I run a small OO Launching app to copy from my drive to the Flash Drive, I get the "Action not supported. Invalid procedure call." Error.

I am using a 2017 Mac Book Pro running OS X 13.4 and a PC running Vista. Any other suggestions?

Re: File saved to FlashDrive using macro gives Disk Locked error

Posted: Mon Apr 28, 2025 2:48 pm
by EthanCrawford
It might be related to how the path is being handled between Mac OS and the USB drive. Mac OS sometimes applies different permissions or resource forks when dealing with external drives.
Before copying, check if the flash drive path is properly converted using ConvertToURL, similar to how it was suggested for SaveAs.
Example:

Code: Select all

Dim srcPath As String
Dim destPath As String

srcPath = "file:///Users/YourUserName/Documents/yourfile.ods"
destPath = "file:///Volumes/YourFlashDriveName/yourfile.ods"

FileCopy(ConvertFromURL(srcPath), ConvertFromURL(destPath))
Notice that FileCopy expects regular system paths, not URLs. So you might need ConvertFromURL instead of ConvertToURL before copying.

Also, ensure the flash drive is properly mounted and writable (sometimes Mac OS mounts USB drives as "read only" if it detects issues).