J
Jeff
Greetings,
I Have a few questions, and am quite stumped
1. In Word is there an alternitive to the API call to pause the applications
progress?
2. Does the Sleep Procedure halt the OS or just the application?
3. My over all problem is I am moving a file from one folder to the another.
The trouble is at runtime I get a "Permission denied" error, If I place a
Break Point on the sub procedure to move the file or step through it it
works fine this problem only occurs @ runtime. See Code below
Sub MovePrintedFile(ByVal sFileName As String)
Dim oFSO As Object
Dim sDestinationFolder As String
On Error GoTo MovePrintedFile_Error
sDestinationFolder = "\\NetworkShare\ShareA\SomePath\"
Set oFSO = CreateObject("Scripting.FileSystemObject")
If Not oFSO.FolderExists(sDestinationFolder) Then
oFSO.CreateFolder (sDestinationFolder)
End If
'throws error here @ runtime
' No error if Breakpoint placed here or stepped through
Call oFSO.MoveFile(sFileName, sDestinationFolder)
MovePrintedFile_Exit:
Set oFSO = Nothing
Exit Sub
MovePrintedFile_Error:
Debug.Print sFileName & vbCr & Err.Description
Stop
Resume MovePrintedFile_Exit
End Sub
I Have a few questions, and am quite stumped
1. In Word is there an alternitive to the API call to pause the applications
progress?
2. Does the Sleep Procedure halt the OS or just the application?
3. My over all problem is I am moving a file from one folder to the another.
The trouble is at runtime I get a "Permission denied" error, If I place a
Break Point on the sub procedure to move the file or step through it it
works fine this problem only occurs @ runtime. See Code below
Sub MovePrintedFile(ByVal sFileName As String)
Dim oFSO As Object
Dim sDestinationFolder As String
On Error GoTo MovePrintedFile_Error
sDestinationFolder = "\\NetworkShare\ShareA\SomePath\"
Set oFSO = CreateObject("Scripting.FileSystemObject")
If Not oFSO.FolderExists(sDestinationFolder) Then
oFSO.CreateFolder (sDestinationFolder)
End If
'throws error here @ runtime
' No error if Breakpoint placed here or stepped through
Call oFSO.MoveFile(sFileName, sDestinationFolder)
MovePrintedFile_Exit:
Set oFSO = Nothing
Exit Sub
MovePrintedFile_Error:
Debug.Print sFileName & vbCr & Err.Description
Stop
Resume MovePrintedFile_Exit
End Sub