Consulting

Results 1 to 8 of 8

Thread: Sleeper: Saveas dialog

  1. #1

    Sleeper: Saveas dialog

    hi everyone !
    i have a problem for a long time:
    i'm trying to open a "save as" dialog in a apecific folder (D:\2005\Temp) that the user only writes the file name and push enter.
    i'm using this code:
    Excel.Application.Dialogs(xlDialogSaveAs).Show "D:\2005\Temp".
    the problem is that the dialog is open at the same directory that the file originally opened. (if i had the file on the desktop directory then the default directory on the "save as" dialog is the desktop).
    if anyone have any suggesttions i'll be happy to hear it.
    thank you.
    jony.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    ChDrive "C:\myTest"
    ChDir "C:\myTest"
    Application.Dialogs(xlDialogSaveAs).Show
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3

    no

    no, tried that.... not working.
    thanks.

  4. #4
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    Can you post what you tried (code)? Did you try stepping through your code with F8? What is the offending line? Do you receive an error? If so, what error exactly?

  5. #5
    VBAX Tutor TheAntiGates's Avatar
    Joined
    Feb 2005
    Location
    Tejas
    Posts
    263
    Location
    http://support.microsoft.com/?kbid=213371

    Both methods should have worked. You may be corrupt.

    Admittedly a workaround, but possibly useful is
    dim foo '(As Variant)
    foo = Application.GetSaveAsFilename(, , , Title:="Set destination dir")
    early on in your code, and .SaveAs should subsequently use its specification.
    I just found a cool semi-advanced VBA page - dictionary, queue, etc. http://analystcave.com/excel-vba-dic...ta-structures/

  6. #6
    firefytr vbmenu_register("postmenu_38365", true); , the code is the code i just wrote above, but here it again:

    Sub SaveToFolder()
    Fpath = ("D:\2005\temp\tax.xls")
    Excel.Application.Dialogs(xlDialogSaveAs).Show (Fpath)
    end sub
    i debuged it and there is no problem apear to be and i get no error also.

    TheAntiGates, the line you wrote:
    foo = Application.GetSaveAsFilename(, , , Title:="Set destination dir")
    and after that: saveas....
    it's seems ok, but if i type name of existin file i get a "run time" error.

    i just trying to understand why the command i used won't work, it only write the file name (tax.xls) but not the path (D:\2005\temp), the path is the path that i opend the file from.

    also the link to microsoft says:
    To create a macro (SaveDialogFile) that will start the Save As dialog box and select a specific file name and path, use the following Visual Basic sample code:

    Sub SaveDialogFile()
       Application.Dialogs(xlDialogSaveAs).Show ("<drive>:\<path>\<filename>")
    End Sub

  7. #7
    VBAX Tutor TheAntiGates's Avatar
    Joined
    Feb 2005
    Location
    Tejas
    Posts
    263
    Location
    I really don't know - you don't seem to have any code flaws. Perhaps the problem is that D:\2005\temp doesn't exist.
    I just found a cool semi-advanced VBA page - dictionary, queue, etc. http://analystcave.com/excel-vba-dic...ta-structures/

  8. #8
    the folder exist, i wonder if only i have this problem or anyone here succeed.

Posting Permissions

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