Domanda

I have a macro in my excel and when I use .SaveAs in said macro, it automatically saves the file in my documents (when I dont specify a path)

I really dont want to specify a path, I just want it to save the resulting file in the directoy where excel book is.

heres the save code:

    fnameandpath = InputBox("Please Enter A New File Name")
    If fnameandpath = Empty Then
        'warn user

    Else  
        ActiveWorkbook.SaveAs fnameandpath
        Range("A1").Activate
    End If

so for example, I put my excel file on my desktop. I enter in "TestFile" when the box pops, then I get an xlsm file in my documents rather than on my desktop. Why? Can I change that default behavior? the msdn says it saves to the current location.

È stato utile?

Soluzione

not that anyone is ever going to look at this but, there is indeed a default save path in excel. for 2010 anyways its options - save - default file location. the default is the documents folder.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top