tag:blogger.com,1999:blog-7176045.post2459526972869400439..comments2008-06-17T12:23:17.426+04:00Comments on Alex & Access: Zip files with the default Windows XP zip programAlex Dybenkohttp://www.blogger.com/profile/16954512620659022712noreply@blogger.comBlogger12125tag:blogger.com,1999:blog-7176045.post-66893644682204444092008-06-17T12:23:00.000+04:002008-06-17T12:23:00.000+04:002008-06-17T12:23:00.000+04:00no, but you can use dir() for get all such directo...no, but you can use dir() for get all such directories and then run rmdir for eachAlex Dybenkohttp://www.blogger.com/profile/16954512620659022712noreply@blogger.comtag:blogger.com,1999:blog-7176045.post-18468610895036545972008-06-17T12:20:00.000+04:002008-06-17T12:20:00.000+04:002008-06-17T12:20:00.000+04:00Thank you Alex, can you use the asterisk with RmDi...Thank you Alex, can you use the asterisk with RmDir as well?<BR/>RmDir(Environ("Temp") & "\Temporary Directory*")grovellihttp://www.blogger.com/profile/01864327852651903204noreply@blogger.comtag:blogger.com,1999:blog-7176045.post-51450116164994916532008-06-17T12:05:00.000+04:002008-06-17T12:05:00.000+04:002008-06-17T12:05:00.000+04:00ok, i looked at htm file only. no idea why he remo...ok, i looked at htm file only. no idea why he removes these temp folders, perhaps they are created automatiacally during zip process. Anyway - i would better use RmDir instead of FSOAlex Dybenkohttp://www.blogger.com/profile/16954512620659022712noreply@blogger.comtag:blogger.com,1999:blog-7176045.post-43842823954050214812008-06-17T11:49:00.000+04:002008-06-17T11:49:00.000+04:002008-06-17T11:49:00.000+04:00???Of course those lines are present in the origin...???<BR/>Of course those lines are present in the original code. Please check <BR/>http://www.rondebruin.nl/files/windowsxpunzip.txtgrovellihttp://www.blogger.com/profile/01864327852651903204noreply@blogger.comtag:blogger.com,1999:blog-7176045.post-15543644313209680222008-06-17T11:44:00.000+04:002008-06-17T11:44:00.000+04:002008-06-17T11:44:00.000+04:00Hi Giorgio,i do not see such line in originale cod...Hi Giorgio,<BR/>i do not see such line in originale code, but if you create a temp dir - then it is good idea to delete it after allAlex Dybenkohttp://www.blogger.com/profile/16954512620659022712noreply@blogger.comtag:blogger.com,1999:blog-7176045.post-13278631729942618242008-06-17T11:26:00.000+04:002008-06-17T11:26:00.000+04:002008-06-17T11:26:00.000+04:00Alex, in Sub Unzip2() above, why are the linesSet ...Alex, in Sub Unzip2() above, why are the lines<BR/>Set FSO = CreateObject("scripting.filesystemobject")<BR/>FSO.DeleteFolder Environ("Temp") & "\Temporary Directory*", True<BR/>used? Why do you need to delete the temporary folder?grovellihttp://www.blogger.com/profile/01864327852651903204noreply@blogger.comtag:blogger.com,1999:blog-7176045.post-12015264994718280842008-06-13T09:06:00.000+04:002008-06-13T09:06:00.000+04:002008-06-13T09:06:00.000+04:00Ciao Giorgio!strFilter = ahtAddFilterItem(strFilte...Ciao Giorgio!<BR/>strFilter = ahtAddFilterItem(strFilter...<BR/>see the function - it adds filters to a string strFilter in some format, you can call it several times to add more filters<BR/><BR/>.CopyHere - i think you can try to use FileCopy<BR/><BR/>Thanks for posting!Alex Dybenkohttp://www.blogger.com/profile/16954512620659022712noreply@blogger.comtag:blogger.com,1999:blog-7176045.post-91578648843885934742008-06-13T01:45:00.000+04:002008-06-13T01:45:00.000+04:002008-06-13T01:45:00.000+04:00Found the solution, in the sub posted previously, ...Found the solution, in the sub posted previously, I use<BR/>Dim strInputFileName<BR/>instead of<BR/>Dim strInputFileName as Stringgrovellihttp://www.blogger.com/profile/01864327852651903204noreply@blogger.comtag:blogger.com,1999:blog-7176045.post-71871550755165561262008-06-12T12:58:00.000+04:002008-06-12T12:58:00.000+04:002008-06-12T12:58:00.000+04:00Anyway, I've tried and modified Sub Unzip2() at h...Anyway, I've tried and modified Sub Unzip2() at http://www.rondebruin.nl/files/windowsxpunzip.txt using the API call <BR/>but the code stops at the line<BR/>oApp.Namespace(FileNameFolder).CopyHere oApp.Namespace(strInputFileName).Items<BR/>with the message 'run-time error 91 "Object variable or with block variable not set'<BR/><BR/>Here's the modified sub:<BR/>Sub Unzip2() 'http://www.rondebruin.nl/files/windowsxpunzip.txt<BR/> Dim FSO As Object<BR/> Dim oApp As Object<BR/> Dim fname<BR/> Dim FileNameFolder<BR/> Dim DefPath As String<BR/><BR/> 'fname = Application.GetOpenFileName(filefilter:="Zip Files (*.zip), *.zip", _<BR/> ' MultiSelect:=False)<BR/> Dim strFilter As String<BR/>Dim strInputFileName As String<BR/><BR/>strFilter = ahtAddFilterItem(strFilter, "Zip Files (*.zip), *.zip") 'http://www.mvps.org/access/api/api0001.htm<BR/>strInputFileName = ahtCommonFileOpenSave( _<BR/> Filter:=strFilter, OpenFile:=True, _<BR/> DialogTitle:="Please select an input file...", _<BR/> Flags:=ahtOFN_HIDEREADONLY)<BR/> If strInputFileName = "" Then<BR/> 'do nothing<BR/> Else<BR/> DefPath = "C:\Test\" '<<< Change path<BR/> If Right(DefPath, 1) <> "\" Then<BR/> DefPath = DefPath & "\"<BR/> End If<BR/><BR/> FileNameFolder = DefPath<BR/><BR/> Set oApp = CreateObject("Shell.Application")<BR/> 'Copy the files in the newly created folder<BR/> oApp.Namespace(FileNameFolder).CopyHere oApp.Namespace(strInputFileName).Items<BR/><BR/> MsgBox "You find the files here: " & FileNameFolder<BR/> On Error Resume Next<BR/> Set FSO = CreateObject("scripting.filesystemobject")<BR/> FSO.DeleteFolder Environ("Temp") & "\Temporary Directory*", True<BR/><BR/> Set oApp = Nothing<BR/> Set FSO = Nothing<BR/> End If<BR/>End Subgrovellihttp://www.blogger.com/profile/01864327852651903204noreply@blogger.comtag:blogger.com,1999:blog-7176045.post-29895452143582512642008-06-12T11:43:00.000+04:002008-06-12T11:43:00.000+04:002008-06-12T11:43:00.000+04:00Thank you Alex, I'm using the API described here: ...Thank you Alex, I'm using the API described here: <BR/>http://www.mvps.org/access/api/api0001.htm<BR/>but I don't understand this line:<BR/>strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.XLS)", "*.XLS")<BR/>strFilter is calling itself as an argument of the ahtAddFilterItem function?!grovellihttp://www.blogger.com/profile/01864327852651903204noreply@blogger.comtag:blogger.com,1999:blog-7176045.post-40227774456789022902008-06-12T09:43:00.000+04:002008-06-12T09:43:00.000+04:002008-06-12T09:43:00.000+04:00Ciao Giorgio!yes, GetOpneFileName and browse for f...Ciao Giorgio!<BR/>yes, GetOpneFileName and browse for folder does not work in access, so you have to replace them with API calls like at www.mvps.org/accessAlex Dybenkohttp://www.blogger.com/profile/16954512620659022712noreply@blogger.comtag:blogger.com,1999:blog-7176045.post-47562888884097138492008-06-11T22:28:00.000+04:002008-06-11T22:28:00.000+04:002008-06-11T22:28:00.000+04:00Ciao Alex!!! :-)Does this technique work with VBA ...Ciao Alex!!! :-)<BR/>Does this technique work with VBA in Access?<BR/>I've tried http://www.rondebruin.nl/files/windowsxpunzip.txt<BR/>but GetOpenFileName isn't recognized as a method or data member.grovellihttp://www.blogger.com/profile/01864327852651903204noreply@blogger.com