Parameters or Arguments: The ChDIr function/statement has one argument in Excel VBA. Is there an easy way to do this.

I'm trying to save a document to same folder everytime but prompt the user for a file name. ChDir statement 12/03/2018 2 minutes to read +1 In this article Changes the current directory or folder. Behaviour of links in excel is described in this good document. The path may include the drive. may include the drive.
Here is a work around that I came up with for right now.

where Path: It is a mandatory string type parameter. its part of a bigger macro but the relevent code is below : Dim filename As String filename = InputBox("Name for new file?") I thought ChDir "..\..\Desktop" would do the trick, but VBA does not like that. It is a mandatory string type parameter.

You may not post new threads; You may not post replies; You may not post attachments; You may not edit your posts Overview of VBA ChDir Function: VBA ChDir function is categorized as File and Directory function. In VBA I need to open a workbook using the UNC pathname.

Let's look at some Excel CURDIR function examples and explore how to use the CURDIR function in Excel VBA code: CurDir () Result: "C:\Documents and Settings\user\My Documents" CurDir ("G") Result: "G:\" This built-in VBA ChDir statement changes the current or default folder or directory in Excel. Help on the exact syntax can be found by looking 'up the GetOpenFilename method in the VBA help files GetOpenFilenameFrom = Application.GetOpenFilename _ ("Excel Files (*.xl*), *.xl*,All Files (*.*),*. Syntax of VBA ChDir Function The syntax of the ChDir Function in VBA is ChDir(Path) The ChDir Function changes the current directory or folder name . Example (as VBA Function) The CURDIR function can only be used in VBA code in Microsoft Excel. Right now the code is: mfdate = FileDateTime("HG Equipment Tracking Matrix.xls") I need to add the UNC pathname to the file name. Re: VBA to open Network drive without mappping the drive.

ChDrive/ChDir don't work with UNC paths. \\server\volume\folder instead of Z: It use to be a code with Chdir to accomplish this, however that is only compatible with a drive letter, and I don't … Nothing seems to work. Like I said, you don't need to change to a particular drive to open a file from it and most VBA commands can use the UNC path so I can't see where the problem is once you know the share name. This function can be used in either procedure or function in a VBA editor window in Excel.

One particular macro has been giving me trouble, I need it to save multiple workbooks using the UNC path Ex. The UNC pathname is: \\beavertn-nas-06\twikle\ What is … Syntax ChDir path The required path argument is a string expression that identifies which directory or folder becomes the new default directory or folder.

Re: Excel VBA - use UNC path to open Access database.

Description of link management and storage in Excel. Looking at an excel cell when document opened via UNC path vs Looking at excel cell when document opened via mapped drive path: =+VLOOKUP(C10,'\\domain.net\folds\USERS\design\bill\[Costings.xls]Sheet1'!GpData,2,FALSE)

The folder is located on a server and has a UNC path. It works no matter which computer I run the code from, however I would rather just open my Database using UNC if I can: But Ron's suggestion of the API will work with UNC or mapped drives. I would like to make the user's Desktop the current directory.