2

I am quite new to ArcObjects and development, but from what I have researched I can run a command programmatically like so: [VB]

Dim pUID As New UID
Dim pCmdItem As ICommandItem
pUID.Value = "esriArcMapUI.MxFileMenuItem"
pUID.Subtype = 4 'For Save As command
Set pCmdItem = Application.Document.CommandBars.Find(pUID)
pCmdItm.Execute

However I want to extend this example so when it executes it changes defaults to always the same folder location and filename. Is this possible with ICommandItem, or do I need another interface?

1

The only way I can think of is similar to this answer (to question Force a new AddDataDialog to open at a defined directory path). In your case, you would use a different registry key though:

HKEY_CURRENT_USER\Software\ESRI\ArcMap\File Path

where File Path is the name of a string value pointing to the directory which the Save dialog uses. This method will of course not allow you to specify the actual file name, only the default directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.