0

The old open file dialog that I used with QLikView no longer works on Win7. The sub used "MSComDlg.CommonDialog" and this was the code for the Sub.

' Sub to show open/save dialog
SUB OpenSave (varOpenSaveInputBox, varOpenSaveType, varOpenSaveFilter)   
   ' Create object
   SET objComDlg32 = CreateObject("MSComDlg.CommonDialog")
   ' Set memory buffer
   objComDlg32.MaxFileSize = 260
   ' Set filter
   objComDlg32.Filter = varOpenSaveFilter
   ' Show dialog 
   IF varOpenSaveType = 0 Then
      objComDlg32.ShowOpen
   ELSE
      objComDlg32.ShowSave
   End IF    
   ' Get filename from dialog
   strOpenSave = objComDlg32.FileName
   ' Check IF dialog is cancelled
   IF strOpenSave <> vbNullString Then
      ' Set to variable
      objOpenSave.SetContent strOpenSave, TRUE
   End If
END SUB

Can anyone suggest an open file dialog that works?

disasterkid
  • 6,948
  • 25
  • 94
  • 179

2 Answers2

1

MSComDlg.CommonDialog is still alive and active (registered) under Windows 7 (tested), it's abandoned in Windows 8. I presume you run on 64bit OS, while that control run in 32bit environment only. So, if this is the case, all that need to do is to run your .vbs script as 32bit process using WScript.exe/CScript.exe versions resided in your SysWOW64 directory.

%WinDir%\SysWOW64\WScript.exe script.vbs
%WinDir%\SysWOW64\CScript.exe script.vbs
Panayot Karabakalov
  • 3,109
  • 3
  • 19
  • 28
  • That is just not correct. It will not work in WindowsRT but otherwise Microsoft supports vb6 for all other versions of its operating system. http://msdn.microsoft.com/en-us/vstudio/ms788708.aspx – Archlight Mar 25 '13 at 16:14
  • I'm not work with mobile devices, so I can't tell anything about Windows RT, but did that mean what I said is abs wrong? I still have scripts using that dialog on (desktop) Windows 7. Thanks for the note anyway. – Panayot Karabakalov Mar 26 '13 at 06:14
0

comdlg32.dll is only installed if you have visual studio or similar installed.

http://support.microsoft.com/kb/957924 or download it from the net.

Place it in system32 folder and register it with regsvr32.exe

or for 64 bit

regsvr32 c:\Windows\SysWOW64\comdlg32.ocx

And it works.

Archlight
  • 2,019
  • 2
  • 21
  • 34