Vbs script error need help

Asked By 10 points N/A Posted on -

Hi All,

This code is for zipping files in a folder and get this error


Windows Script Host





Error:Type mismatch: 'strWinzip'


Source: Microsoft VBScript runtime error




strDate = Year(Date) & Right("0" & Month(Date), 2) & Right("0" & Day(Date), 2) & Right("0" & Hour(Now), 2) & Right("0" & Minute(Now), 2) & Right("0" & Second(Now), 2)

strFolderToZip = "F:test"

strZipFileToCreate = "F:testSubfolder_" & strDate & ".zip"

strWinzip = "C:Program FilesWinZipWinzip32.exe"

Set objFSO = CreateObject("Scripting.FileSystemObject")

strWinZip objFSO.GetFile(strWinZip).ShortPath

strCommand = strWinzip & " -min -a -r """ & strZipFileToCreate & """ """ & strFolderToZip & """"

objShell.Run strCommand, 1, True

MsgBox "Done"

Can anyone help please

Answered By 0 points N/A #82821

Vbs script error need help


    Hi there. I always encounter that type of error – type mismatch. When I go back to my codes,  it seems that there is nothing wrong with it. If the data type of the variable, which will be the value to be inserted to the database, does not match the data type of the column where that variable should be inserted there will be an error. For example you will insert an IDno variable of type character from the program to the IDno column of type integer in the database an error will occur. If the values are not compatible, there is a type mismatch error.

Login/Register to Answer

Related Questions