Andrew Douglas Pitonyak wrote:
Dennis J. Tuchler wrote:

Occasionally, I want to save a spreadsheet or other document to my hard drive and to a usb device. I find it tedious to save periodically to both devices. Is there "out there" a macro that saves a document to two different places?


This macro would be TRIVIAL to write. Are you willing to learn :-)

This is untested code. This means that I typed it and I did not test it. I have not verified anything about this code. It has never existed in a macro environment. I simply typed it into the text window and sent it on its way. My expectation is that it WILL work. If you have a problem with it, you probably need to email me off list so that I will notice that I have an email message...

Sub SpecialStore()
 REM If nothing to save....
 If (NOT ThisComponent.isModified) Then Exit Sub

 REM If there is no place to save this document, then do not try yet...
If (NOT ThisComponent.hasLocation) OR ThisComponent.isReadOnly Then Exit Sub

 REM At this point, the document can be saved AND it has a location!
 REM Save the document!
 ThisComponent.store()

 REM Now, save the document to the external location as well, but
 REM do NOT change the current URL
 Dim sBaseURL As String
 Dim sDocURL As String
 Dim sFileName As String

 REM Set this to the base directory on your USB drive or where ever!
 sBaseURL = "file:///e:/my_stuff/whereveer/"

 REM Load the tools library if it is not already loaded
 If (Not GlobalScope.BasicLibraries.isLibraryLoaded("Tools")) Then
   GlobalScope.BasicLibraries.LoadLibrary("Tools")
 End If

 REM If this generates an error, then try getURL() instead.
 sDocURL = ThisComponent.getLocation()
 sFileName = FileNameoutofPath(sDocURL)
 ThisComponent.storeToURL(sBaseURL & sFileName, Array())
End Sub



Thank you!   I'll try it.

--
Best regards,

Dennis J. Tuchler
University City, Missouri 63130

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to