Issue on setting DefaultFilePath property in excel

Hi,
       Through my application I am setting the DefaultFilePath for the excel application so that the worksheets currently active will default to specific folder when the user tries to save the excel file manualy.

The issue I am facing is that the DefaultFilePath is not set for current/active excel application. It set only when the excel application is opend for the second time.

I want the DefaultFilePath to be effective with the active excel application. Please let me know how to accomplish this.

Gopinath
Gopinath74Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MuraliCommented:
I dont think you can do this.. bcoz when you open excel.exe all these variable (DefaultFilePath and DefaultSavingLocation) will be loaded with applicaltion. Once the application is opened these are constants which you cannot modify for active app... if you modify these values, will effect on next load of app (excel.exe)..

Until nex load time the excel.exe will treat the old values (what was the value when it loaded) as active and new ones will take effect on next load..
MuraliCommented:
One way is... first set up the desire DefaultFilePath on user machine
and let your application do not set the DefaultPathLocation as it is already configured in user machine...
the only problem here is for all excel files it list the same path..

The another way is... let your application save the excel file in desired location first (your desired DefaultPathLocation) and then open the file to user...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Gopinath74Author Commented:
Due to limitations in Excel application, the solution provided is a work around.
Gopinath74Author Commented:
But it helps me to resolve my problem.

I took the second option provided in the solution by opening the excel application temporarily, set the default value and close the excel application immediately. By this the excel application will default to the specific folder as specified in the DefaultPath property. Then open the excel application, do necessary business / data population and show it to the user. So when user intends to save the excel, it will default to a specific folder as specified in the DefaultPath directory.

Thanks Murali.
MuraliCommented:
Thank you and most welcome.. :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.