ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problems setting Application.DefaultFilePath (https://www.excelbanter.com/excel-programming/333807-problems-setting-application-defaultfilepath.html)

paulojfonseca

Problems setting Application.DefaultFilePath
 

Dear all,

I'm currently writing an Excel macro and in that macro i need to change
the Default File Path (where i open\save my files concerning this
macro)

I know that setting Application.DefaultFilePath is what i need to do,
but
if i write a simple macro like this:


Code:
--------------------

Sub test()
With Application
.UserName = "Paulo Fonseca"
.StandardFont = "Arial"
.StandardFontSize = "10"
.DefaultFilePath = "c:\test"
.EnableSound = False
.RollZoom = False
End With
End Sub

--------------------


and then run it nothing changes, except the field in
TOOLS-OPTIONS-GENERAL- Default File Locations witch is now c:\test .
But still when i click on Open File it goes to the previous location.

If i do this procedure by hand (going through the menus and change the
Default file location), and then click on Open File it works!!

Do i miss any command ond my macro?
Thanks in advance

Best regards
Paulo Fonseca


--
paulojfonseca
------------------------------------------------------------------------
paulojfonseca's Profile: http://www.excelforum.com/member.php...o&userid=24976
View this thread: http://www.excelforum.com/showthread...hreadid=385071


STEVE BELL

Problems setting Application.DefaultFilePath
 
Maybe you are looking for this:

(from VBE Help)
The ChDir statement changes the default directory but not the default drive.
For example, if the default drive is C, the following statement changes the
default directory on drive D, but C remains the default drive:

ChDir "D:\TMP"
--
steveB

Remove "AYN" from email to respond
"paulojfonseca"
wrote in message
news:paulojfonseca.1rrqej_1120687529.6359@excelfor um-nospam.com...

Dear all,

I'm currently writing an Excel macro and in that macro i need to change
the Default File Path (where i open\save my files concerning this
macro)

I know that setting Application.DefaultFilePath is what i need to do,
but
if i write a simple macro like this:


Code:
--------------------

Sub test()
With Application
.UserName = "Paulo Fonseca"
.StandardFont = "Arial"
.StandardFontSize = "10"
.DefaultFilePath = "c:\test"
.EnableSound = False
.RollZoom = False
End With
End Sub

--------------------


and then run it nothing changes, except the field in
TOOLS-OPTIONS-GENERAL- Default File Locations witch is now c:\test .
But still when i click on Open File it goes to the previous location.

If i do this procedure by hand (going through the menus and change the
Default file location), and then click on Open File it works!!

Do i miss any command ond my macro?
Thanks in advance

Best regards
Paulo Fonseca


--
paulojfonseca
------------------------------------------------------------------------
paulojfonseca's Profile:
http://www.excelforum.com/member.php...o&userid=24976
View this thread: http://www.excelforum.com/showthread...hreadid=385071





All times are GMT +1. The time now is 01:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com