Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Problems with ChDrive, ChDir

Hello Everyone!

I've got two practically identical macros. One works all
the time, one never. I can't work out why Open works, but
SaveAs doesn't. Does anyone have any idea??

TIA

Sxx


Sub FileOpenDirectory()
Dim strDirectory As String

strDirectory = Excel.CommandBars.ActionControl.Tag

ChDrive Left(strDirectory, 1)
ChDir strDirectory
Application.Dialogs(xlDialogOpen).Show

End Sub
Sub FileSaveAsDirectory()
Dim strDirectory As String

strDirectory = Excel.CommandBars.ActionControl.Tag

ChDrive Left(strDirectory, 1)
ChDir strDirectory
Application.Dialogs(xlDialogSaveAs).Show

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Problems with ChDrive, ChDir

Nothing obvious, it works okay for me. Are you sure Tag is set for both
controls?

Have you debugged what Tag is on entering the macros?

Also, ChDrive strDirectory is good enough, you don't need Left..

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Sophie" wrote in message
...
Hello Everyone!

I've got two practically identical macros. One works all
the time, one never. I can't work out why Open works, but
SaveAs doesn't. Does anyone have any idea??

TIA

Sxx


Sub FileOpenDirectory()
Dim strDirectory As String

strDirectory = Excel.CommandBars.ActionControl.Tag

ChDrive Left(strDirectory, 1)
ChDir strDirectory
Application.Dialogs(xlDialogOpen).Show

End Sub
Sub FileSaveAsDirectory()
Dim strDirectory As String

strDirectory = Excel.CommandBars.ActionControl.Tag

ChDrive Left(strDirectory, 1)
ChDir strDirectory
Application.Dialogs(xlDialogSaveAs).Show

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Problems with ChDrive, ChDir

Hi RP

I guess I should have made it simpler in the first
instance, was being a bit lazy I guess. Even when the
code is as simple as below my open works, but not my
SaveAs, I take it this works for you?

Sub FileOpenDirectory()
ChDrive "C"
ChDir "C:\1"
Application.Dialogs(xlDialogOpen).Show

End Sub
Sub FileSaveAsDirectory()

ChDrive "C"
ChDir "C:\1"
Application.Dialogs(xlDialogSaveAs).Show

End Sub


Thanks

S




-----Original Message-----
Nothing obvious, it works okay for me. Are you sure Tag

is set for both
controls?

Have you debugged what Tag is on entering the macros?

Also, ChDrive strDirectory is good enough, you don't

need Left..

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Sophie" wrote in

message
...
Hello Everyone!

I've got two practically identical macros. One works

all
the time, one never. I can't work out why Open works,

but
SaveAs doesn't. Does anyone have any idea??

TIA

Sxx


Sub FileOpenDirectory()
Dim strDirectory As String

strDirectory = Excel.CommandBars.ActionControl.Tag

ChDrive Left(strDirectory, 1)
ChDir strDirectory
Application.Dialogs(xlDialogOpen).Show

End Sub
Sub FileSaveAsDirectory()
Dim strDirectory As String

strDirectory = Excel.CommandBars.ActionControl.Tag

ChDrive Left(strDirectory, 1)
ChDir strDirectory
Application.Dialogs(xlDialogSaveAs).Show

End Sub



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Problems with ChDrive, ChDir

Yes, that is the sort of thing I did in my test, and although I didn't have
a number directory name, but having just done so, it works for me.

Bob


wrote in message
...
Hi RP

I guess I should have made it simpler in the first
instance, was being a bit lazy I guess. Even when the
code is as simple as below my open works, but not my
SaveAs, I take it this works for you?

Sub FileOpenDirectory()
ChDrive "C"
ChDir "C:\1"
Application.Dialogs(xlDialogOpen).Show

End Sub
Sub FileSaveAsDirectory()

ChDrive "C"
ChDir "C:\1"
Application.Dialogs(xlDialogSaveAs).Show

End Sub


Thanks

S




-----Original Message-----
Nothing obvious, it works okay for me. Are you sure Tag

is set for both
controls?

Have you debugged what Tag is on entering the macros?

Also, ChDrive strDirectory is good enough, you don't

need Left..

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Sophie" wrote in

message
...
Hello Everyone!

I've got two practically identical macros. One works

all
the time, one never. I can't work out why Open works,

but
SaveAs doesn't. Does anyone have any idea??

TIA

Sxx


Sub FileOpenDirectory()
Dim strDirectory As String

strDirectory = Excel.CommandBars.ActionControl.Tag

ChDrive Left(strDirectory, 1)
ChDir strDirectory
Application.Dialogs(xlDialogOpen).Show

End Sub
Sub FileSaveAsDirectory()
Dim strDirectory As String

strDirectory = Excel.CommandBars.ActionControl.Tag

ChDrive Left(strDirectory, 1)
ChDir strDirectory
Application.Dialogs(xlDialogSaveAs).Show

End Sub



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Problems with ChDrive, ChDir

Thanks Bob

I will try on a couple of other machines
Thanks for your time

S


-----Original Message-----
Yes, that is the sort of thing I did in my test, and

although I didn't have
a number directory name, but having just done so, it

works for me.

Bob


wrote in message
...
Hi RP

I guess I should have made it simpler in the first
instance, was being a bit lazy I guess. Even when the
code is as simple as below my open works, but not my
SaveAs, I take it this works for you?

Sub FileOpenDirectory()
ChDrive "C"
ChDir "C:\1"
Application.Dialogs(xlDialogOpen).Show

End Sub
Sub FileSaveAsDirectory()

ChDrive "C"
ChDir "C:\1"
Application.Dialogs(xlDialogSaveAs).Show

End Sub


Thanks

S




-----Original Message-----
Nothing obvious, it works okay for me. Are you sure

Tag
is set for both
controls?

Have you debugged what Tag is on entering the macros?

Also, ChDrive strDirectory is good enough, you don't

need Left..

--

HTH

RP
(remove nothere from the email address if mailing

direct)


"Sophie" wrote

in
message
...
Hello Everyone!

I've got two practically identical macros. One works

all
the time, one never. I can't work out why Open

works,
but
SaveAs doesn't. Does anyone have any idea??

TIA

Sxx


Sub FileOpenDirectory()
Dim strDirectory As String

strDirectory =

Excel.CommandBars.ActionControl.Tag

ChDrive Left(strDirectory, 1)
ChDir strDirectory
Application.Dialogs(xlDialogOpen).Show

End Sub
Sub FileSaveAsDirectory()
Dim strDirectory As String

strDirectory =

Excel.CommandBars.ActionControl.Tag

ChDrive Left(strDirectory, 1)
ChDir strDirectory
Application.Dialogs(xlDialogSaveAs).Show

End Sub


.



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
aauugghhh...#div/o problems & various average formula problems acbel40 Excel Worksheet Functions 5 October 19th 09 05:00 PM
ChDir Error scain2004[_23_] Excel Programming 1 November 4th 04 08:08 PM
chdir not accepting string for path Alan Excel Programming 1 October 13th 04 06:18 PM
Links and Chdir Hansol Excel Programming 3 April 17th 04 08:52 PM
application.dialogs(xlDialogSaveAs) AND CHDIR Jules[_2_] Excel Programming 1 September 3rd 03 08:27 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"