Results 1 to 5 of 5

Thread: [RESOLVED] Common Dialog Problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2010
    Posts
    6

    Resolved [RESOLVED] Common Dialog Problem

    Hello!


    So far i save data by running a measurement, and afterwards open common dialog an save the data under a path.
    What I would like to do, is to define the path where data shall be stored before running the measurement and save the data under the predefined path.
    I tried a bit around but found no solution. Can anyone help me?

    Thanks

    Philip

  2. #2
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Common Dialog Problem

    You could store the selected path to a variable and after the measurement process, store the data to that location...

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Common Dialog Problem

    You could also store the path in a database table field. In that way, you can easily change it if need be without having to recode or recompile.

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Common Dialog Problem

    what path do you want to save the data to?
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2010
    Posts
    6

    Re: Common Dialog Problem

    thx for the replies, I found a solution. I did like this:

    Code:
    Dim fs
    Dim f
        With CDFilepath  'open a with statement as there is a lot of code
            .DialogTitle = ""  'sets the dialog title
            .Flags = cdlOFNPathMustExist + cdlOFNNoChangeDir 
            .filename = ""
            .InitDir = "C:\"  'sets the initial directory
            .Filter = "ASCII files (*.txt;*.log)*.txt;*.log"  'sets the file types
            .ShowSave
            sFileText = .filename
         End With 
      Set fs = CreateObject("Scripting.FileSystemObject")
      Set f = fs.CreateTextFile(sFileText, True)
     
    iFileNo = FreeFile            available for use by the FileOpen function.
    Open sFileText For Append As #iFileNo
    Print #iFileNo, 
    Close #iFileNo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width