Consulting

Results 1 to 10 of 10

Thread: Sleeper: How to save as with fixed name and server location ?

  1. #1
    VBAX Regular
    Joined
    Dec 2017
    Posts
    14
    Location

    Sleeper: How to save as with fixed name and server location ?

    Hello,

    I'm currently blocked on this issue :
    sFileSaveName = Application.GetSaveAsFilename(InitialFileName:=***, fileFilter:="Excel Files (*.xlsx), *.xlsx")
    This opens a Save as dialog box, which is fine,
    The file name is automatically generated ("***") which is also what I want,

    But the default folder is C:/My Documents

    This is not what I want. I want a default folder based on a server where the user can chose the folder where he wants to save the file.

    Thanks for your help.

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,873
    Include the path in the
    InitialFileName:=
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    VBAX Regular
    Joined
    Dec 2017
    Posts
    14
    Location
    I tried something like :

    sFileSaveName = Application.GetSaveAsFilename(InitialFileName:="https://server/folder/" & ***, fileFilter:="Excel Files (*.xlsx), *.xlsx")


    The dialog box opened the right path but in that case didn't put any name

    I know that I'm doing a mistake somewhere. So I'm looking for the right code

    Thanks

  4. #4
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,873
    This works for me:
    sFileSaveName = Application.GetSaveAsFilename(InitialFileName:="C:\blahblah\500 worst Songs\qwerty", fileFilter:="Excel Files (*.xlsx), *.xlsx")
    as did this:
    sFileSaveName = Application.GetSaveAsFilename(InitialFileName:="C:\blahblah\500 worst Songs\qwerty.xlsx", fileFilter:="Excel Files (*.xlsx), *.xlsx")
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  5. #5
    VBAX Regular
    Joined
    Dec 2017
    Posts
    14
    Location
    It doesn't work for me.
    2 things are important to precise :

    In your code the path is a hard drive, in mine it's a web server
    In your code the filename is fixed, in mine it's a variable (a unique ID generated from different values)

  6. #6
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,873
    regarding variables, these all worked:
    dddd = "qwerty"
    sFileSaveName = Application.GetSaveAsFilename(InitialFileName:="C:\blahblah\500 worst Songs\" & dddd, fileFilter:="Excel Files (*.xlsx), *.xlsx")
    dddd = "qwerty.xlsx"
    sFileSaveName = Application.GetSaveAsFilename(InitialFileName:="C:\blahblah\500 worst Songs\" & dddd, fileFilter:="Excel Files (*.xlsx), *.xlsx")
    dddd = "C:\blahblah\500 worst Songs\qwerty.xlsx"
    sFileSaveName = Application.GetSaveAsFilename(InitialFileName:=dddd, fileFilter:="Excel Files (*.xlsx), *.xlsx")
    regarding webservers, this is difficult to test; do you know if there's a specific web server available to the public that I can test this on?
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  7. #7
    VBAX Regular
    Joined
    Dec 2017
    Posts
    14
    Location
    Yes you can test with Google Drive or Dropbox...

  8. #8
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,873
    I'm struggling at the moment; there seem to be a few ways of doing this - Google drive can be mapped to look as if it's local, I guess that's not happening at your end. Can you give me an idea of what's in the this box when you do navigate to the right place:
    2017-12-11_170200.JPG
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  9. #9
    VBAX Regular
    Joined
    Dec 2017
    Posts
    14
    Location
    Hi
    There are just folders containing different files.
    And for information it's a "Microsoft Sharepoint" server.

  10. #10
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,873
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

Tags for this Thread

Posting Permissions

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