+ Reply to Thread
Results 1 to 5 of 5

Filename inludes " " around name when saving

Hybrid View

Apel Filename inludes " " around... 07-25-2009, 08:03 AM
Andy Pope Re: Filename inludes " "... 07-25-2009, 09:58 AM
Apel Re: Filename inludes " "... 07-26-2009, 01:11 AM
Andy Pope Re: Filename inludes " "... 07-26-2009, 07:01 AM
Apel Re: Filename inludes " "... 07-27-2009, 08:41 AM
  1. #1
    Registered User
    Join Date
    05-31-2006
    Posts
    58

    Filename inludes " " around name when saving

    I am saving a .csv to a .xls and regardless of what method I use to save it in a macro there are quote marks around the filename in the dialog box. This only appears to happen if I start with a .csv as I have tested it with a .xls and there is no issue. I have tried using the following code so far.

    Application.Dialogs(xlDialogSaveAs).Show (WkbkName)
    FileSaveName = Application.GetSaveAsFilename(fileFilter:="Excel Files (*.xls), *.xls")
    Last edited by Apel; 07-27-2009 at 08:41 AM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: Filename inludes " " around name when saving

    specify the InitilaFilename rather than let it default to workbook name
    Sub X()
    
        Dim strNewName As String
        Dim vntFileSaveName As Variant
        
        strNewName = Left(ActiveWorkbook.Name, InStr(ActiveWorkbook.Name, ".") - 1) & ".xls"
        vntFileSaveName = Application.GetSaveAsFilename(strNewName, "Excel Files (*.xls), *.xls")
    
    End Sub
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    05-31-2006
    Posts
    58

    Re: Filename inludes " " around name when saving

    That did the trick. I understand the code but not necessarily the logic that created the " " marks other than speculations. Would you briefly be able to explain it?

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: Filename inludes " " around name when saving

    Sorry, no idea why the default is to add quotes to the dialog as they are not used when the value is returned.

  5. #5
    Registered User
    Join Date
    05-31-2006
    Posts
    58

    Re: Filename inludes " " around name when saving

    Okay. I will chalk it up some sort of Excel wierdness. The only legitimate idea I had was because it was a delimited file the "" could be used as a delimiter and this was transferring over. But that is just a wild guess. Thanks for your help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1