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: 430
Default Actual Saved FileName begins with Space

The below code saves my file with a Space
for the first character in the filename. This is
not desirable. How can I eliminate this problem?
TIA,

_MyFile r-111 Apr 2006.xls << where _ is actually a space

Sub SaveWithCellName()
Dim s As String, s1 As String
Dim MyDir As String
On Error Resume Next
MyDir = "C:\Documents and Settings\Jim May\My Documents\MyExcelFormulas\"
ChDir (MyDir)
s = ActiveSheet.Range("G1").Text
s1 = Range("G2").Text _
& Format(Range("G3"), "mmm yyyy") & ".xls"
ActiveWorkbook.SaveAs s & s1
On Error GoTo 0
If Dir(s & s1) < "" Then
MsgBox s1 & " successfully saved"
Else
MsgBox "Problems "
End If
End Sub


 
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
Why is the actual calculation different from actual sample Joe Excel Discussion (Misc queries) 4 May 1st 10 11:46 PM
Max if variable begins with JICDB Excel Worksheet Functions 3 August 7th 09 03:00 PM
If statement - begins with grantr Excel Discussion (Misc queries) 6 October 31st 08 06:35 PM
HelpWhy is "~$filename" 1KB copy of my saved file being created? mars373 Excel Discussion (Misc queries) 1 March 13th 08 07:18 PM
IF Function - Begins With Cecil Excel Discussion (Misc queries) 3 November 23rd 05 03:57 PM


All times are GMT +1. The time now is 12:01 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"