how to add openfiledialog and pass the file location to the DTS package which is saved as VB file?

Thanks.

Sophie, are you using vb6? Would you also want to code the path or file location, or select it from an opened file dialog using the common dialog control? You also mentioned saved as a vb file. I'm not sure what you ar reffering to here?

Please give us some more information.

I have made a DTS package and saved as vb6 file.
This package is to copy file from outside to SQL.
I would like to modify the code such that the user could choose the file by herself using the open file dialog and then get the path.
The package is saved a module.
I don't want to using window form to make the open file dialog.
Is there any other ways?
Thank you so much!

Sophie, my apologies, but I am still confused???:$

I am assuming that your application that the user is using is in VB6?, Although you say that you want the user to open the file, you also say that you do not want to do this from a Form level in VB6. If your user does not know the basics of Windows operating systems and files, they will never find your file. You can use a ListDrive to point them in the right direction and then get them to select the file from there, although I find this more confusing than just using a CommonDialog Control.

CommonDialog Control code would be something like -

This is used loading a picture from file, change as needed.
Dim pattern As String

pattern = "Pictures (*.bmp; *.gif; *.jpg)|*.bmp;*.gif;*.jpg" 'Change to file type i.e. .txt, .mod etc
pattern = pattern & "|All Files (*.*)|*.*" 'Allow to show All files as well...

cdlPhoto.Filter = pattern 'cdlPhoto is the Commondialog control

cdlPhoto.CancelError = True 'Allow user to select cancel
cdlPhoto.ShowOpen

imgIdPhoto.Picture = LoadPicture(cdlPhoto.Filename)

As I mentioned, quite confusing. Does this shed some light on your problem?

This article has been dead for over six months. Start a new discussion instead.