Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / January 2006

Tip: Looking for answers? Try searching our database.

Saving Workbook with VBA assigning Filename from Input On Worksheet

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jrew23 - 09 Jan 2006 16:20 GMT
Hello,  I think this is a relatively easy question.  Can someone let me
know what the correct syntax is below?  Thanks in advance

Sub MyTest()

Application.ScreenUpdating = False

   Dim myFileName As String
   Dim myWorksheetName As String
   Dim myFolder As String

   myFolder = "C:\My Documents\"
   myFileName = Range("A1").Value

   Debug.Print myFolder

           myFileName = myFolder & myFileName & ".xls"
   Debug.Print myFileName

'***********************************************************************************************
'  problem with my syntax below (see ampersand myfilename ampersand)
'  please correct

   ActiveWorkbook.SaveAs Filename:="&myfilename&",
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
       ReadOnlyRecommended:=False, CreateBackup:=False
'**********************************************************************************************

Application.ScreenUpdating = True

End Sub
JE McGimpsey - 09 Jan 2006 16:28 GMT
Not sure why the &s and quotes - did you try:

   ActiveWorkbook.SaveAs Filename:=myFileName, _

??

> Hello,  I think this is a relatively easy question.  Can someone let me
> know what the correct syntax is below?  Thanks in advance
[quoted text clipped - 29 lines]
>
> End Sub
Jrew23 - 09 Jan 2006 16:56 GMT
That worked. Simple enough!  I have to aplogize for taking up your
time! Thanks!!!!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.