About running an app in VB 6.0
I've worked with different languages other than VB 6.0, but it's now I am finally making something on in and I would like you to advise me somehow.
I made a little program which makes it possible for the domain users of my enterprise to save their information to the main server specifically to folders created for each of them. In turn each user has 3 folders where to save to. The structure of those folders is as follows:
\\server\saves\Dept1\userA\Save01
\\server\saves\Dept1\userA\Save02
\\server\salves\Dept1\userA\Save03
\\server\saves\Dept1\userB\Save01
\\server\saves\Dept1\userB\Save02
\\server\salves\Dept1\userB\Save03
\\server\saves\Dept2\userC\Save01
\\server\saves\Dept2\userC\Save02
\\server\salves\Dept2\userC\Save03
\\server\saves\Dept2\userD\Save01
\\server\saves\Dept2\userD\Save02
\\server\salves\Dept2\userD\Save03
... y so on for all the users in every department.
The folder belonging to each user is shared in the server (Ex: userA) so from a workstation a user would have access to his own folder like this: \\server\userA
The program runs ok in my PC with my domain account user but when it comes to run it from any other user logged into the domain, the following error comes up:
Runtime error "-2147024894 (80070002)" Automation Error
Here is the code:
********************************************************
Const SW_HIDE = 0
Const SW_SHOWNORMAL = 1
Const SW_SHOWMINIMIZED = 2
Const SW_SHOWMAXIMIZED = 3
Const SW_SHOWNOACTIVE = 4
Const SW_SHOW = 5
Const SW_MINIMIZE = 6
Const SW_SHOWMINNOACTIVE = 7
Const SW_SHOWNA = 8
Const SW_RESTORE = 9
Sub Main()
Dim oShl As New IWshShell_Class 'Para esperar que una aplicacin termine de ejecutarse
Dim usrprofile, usrname, compname, curpath, strzipco, strzipdoc, mailboxpath, docspath, strSaveNo, savepath As String
Dim l As Long
Dim fso As FileSystemObject 'Para el trabajo con archivos
Dim intWeekDay As Integer
Set fso = New FileSystemObject
usrprofile = Environ("USERPROFILE")
usrname = Environ("USERNAME")
usrdomain = Environ("USERDOMAIN")
compname = Environ("COMPUTERNAME")
'********************************************
If usrdomain <> compname Then
curpath = App.Path
mailboxpath = usrprofile & "\Configuracin local\Datos de programa\Microsoft\Outlook"
docspath = usrprofile & IIf(fso.FolderExists(usrprofile & "\Mis Documentos"), "\Mis Documentos", "\Documentos de " & usrname)
ChDir mailboxpath
strzipco = "wzzip -r -p " & curpath & "\salvaco.zip " & Chr(34) & mailboxpath & "\Outlook.pst" & Chr(34)
l = oShl.Run(strzipco, SW_SW_SHOWNORMAL, True)
ChDir docspath
strzipdocs = "wzzip -r -p " & curpath & "\salvadoc.zip *.doc *.xls *.txt *.pps *.ppt *.pdf"
l = oShl.Run(strzipdocs, SW_SW_SHOWNORMAL, True)
ChDir curpath 'Vuelvo a la carpeta donde estn las salvas de correo y documentos
strSaveNo = ""
intWeekDay = Weekday(Date)
Select Case intWeekDay
Case vbSunday, vbMonday, vbThursday
strSaveNo = "\Salva01\"
Case vbTuesday, vbFriday
strSaveNo = "\Salva02\"
Case Else
strSaveNo = "\Salva03\"
End Select
savepath = "\\servernt\" & usrname & strSaveNo
fso.CopyFile "*.zip", savepath
fso.DeleteFile "*.zip"
Set fso = Nothing
Set oShl = Nothing
MsgBox "Salva Finalizada", vbOKOnly
Else
MsgBox "El usuario " & usrname & " no pertenece al Dominio de la empresa," & vbCrLf & "por lo que no tiene permisos para realizar la salva", vbExclamation, "BackUp"
End If
End Sub
********************************************************
Another issue is that I don't have the Packing & Distribution Wizard option in the Tools menu and I would like to know how to personalize the menu in order for it to appear. I was checking the menu Add-ins but I couldn't solve the problem. Would you also let me know the files needed so that an application runs properly?
Best regards and thanks in advance,
Ral

