ReportSmithing
Programmer
I'm working on an application that uses VB5. I'm using the shell() command in which I open a word document from our shared drive (R
and then poke data into the doc and then save this to C:\My Documents.
Here's the problem, if another user attempts to the run the same application, an error will occur saying that the document is locked by a user. I had thought that if it opened the doc from the R: drive and saved the doc to the C: drive that the R: drive doc shouldn't be active since it's now in C: - I find it's active on both drives!
What code could I add to the below macro to deactivate the document on the R: drive and keep the saved doc on the C: drive up and running?
Sub SaveMeToTemp()
'
' SaveMeToDrive Macro
' Macro created 6/1/2005 by hmrl9cc
'
Dim strFileA, strFileB
strFileA = ActiveDocument.Name
strFileB = "C:\My Documents\" & Format(Date, "yyyy-mm-dd") & "_" & Format(Time, "hh-mm-ss") & "_" & strFileA
ActiveDocument.SaveAs FileName:=strFileB
End Sub
Here my code
Here's the problem, if another user attempts to the run the same application, an error will occur saying that the document is locked by a user. I had thought that if it opened the doc from the R: drive and saved the doc to the C: drive that the R: drive doc shouldn't be active since it's now in C: - I find it's active on both drives!
What code could I add to the below macro to deactivate the document on the R: drive and keep the saved doc on the C: drive up and running?
Sub SaveMeToTemp()
'
' SaveMeToDrive Macro
' Macro created 6/1/2005 by hmrl9cc
'
Dim strFileA, strFileB
strFileA = ActiveDocument.Name
strFileB = "C:\My Documents\" & Format(Date, "yyyy-mm-dd") & "_" & Format(Time, "hh-mm-ss") & "_" & strFileA
ActiveDocument.SaveAs FileName:=strFileB
End Sub
Here my code