LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Code problem

I am using excel 2003. The following code names the file I want saved and
puts it in the correct folder. I want to be able to change the folder I put
it in based on the value of cell j627.




Dim strappend As String
Dim strpath As String
Dim str3 As String

strappend = ActiveSheet.Range("j8").value
strpath = "c:\field tickets\ "
str3 = ActiveSheet.Range("c8").value
fsavename = strpath & strappend & str3 & ".xls"
If Dir(fsavename) < "" Then
fsavename = strpath & strappend & str3 & "a.xls"

End If
ActiveWorkbook.Sheets("Devon ASC f").SaveAs fsavename
ActiveWorkbook.Close False


When I put c:\field tickets\ in cell J627 and change the code as
follows it doesn't work. I would appreciate anyone that can help me figure
out whats wrong. The directory c:\field tickets\ does exist and as I said I
can save the file to that directory if I just don't get the directory from
cell j627:

Dim strappend As String
Dim strpath As String
Dim str3 As String

strappend = ActiveSheet.Range("j8").Value
strpath = ActiveSheet.Range("j627").Value
str3 = ActiveSheet.Range("c8").Value
fsavename = strpath & strappend & str3 & ".xls"
If Dir(fsavename) < "" Then
fsavename = strpath & strappend & str3 & "a.xls"

End If
ActiveWorkbook.Sheets("Devon ASC f").SaveAs fsavename
ActiveWorkbook.Close False



 
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
Code problem puiuluipui Excel Discussion (Misc queries) 3 July 3rd 09 07:27 PM
Alt Code Problem aftamath77 Excel Discussion (Misc queries) 2 February 10th 09 11:42 PM
Problem with code JeffJ Excel Programming 2 June 11th 07 01:29 AM
problem with code MicrosoftNews Excel Programming 3 April 21st 07 09:14 PM
VBA Code problem phaidon Excel Programming 0 October 11th 06 05:52 PM


All times are GMT +1. The time now is 07:03 PM.

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

About Us

"It's about Microsoft Excel"