#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 64
Default Macro help

I am somewhat familiar with macros and understand how to record one. I am
using Excel 2007. I am trying to create a macro: (file, save as, "file
name", and then have Excel finish with the "save" function), but I keep
getting the following error message. Please help! Thanks.

"the following features cannot be saved in macro-free workbooks: VB
project. To save a file with these features, click no and then choose a
macro enabled file type in the file list. To continue saving as a macro-free
workbook click yes."

I have already chosen "enable all macros" in the trust center.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 64
Default Macro help

I figured it out! Now I need to know how to name the file a different name
than the original and save it as a new one. Does anyone know the code for
this? Thanks.

"Rita" wrote:

I am somewhat familiar with macros and understand how to record one. I am
using Excel 2007. I am trying to create a macro: (file, save as, "file
name", and then have Excel finish with the "save" function), but I keep
getting the following error message. Please help! Thanks.

"the following features cannot be saved in macro-free workbooks: VB
project. To save a file with these features, click no and then choose a
macro enabled file type in the file list. To continue saving as a macro-free
workbook click yes."

I have already chosen "enable all macros" in the trust center.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,203
Default Macro help

I think you're probably already there! The same .SaveAs function also
accepts a new filename:

ActiveWorkbook.SaveAs _
Filename:="C:\Users\JLatham\Documents\NewName.xlsm ", _
FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False

And you can substitute a variable for the filename, allowing you to generate
one before executing the command.

Assuming you want to put it into the same folder with the original you can
get the original path from the workbook's .FullName
filePath=Left(ThisWorkbook.FullName, _
InstrRev(ThisWorkbook.FullName,Application.PathSep arator))

and build up some new name:
NewName = "MyNewFileName_" & Year(Now()) & Month(Now()) & Day(Now()) & ".xlsm"
'put the two together
NewName = filePath & NewName

Then execute your .FileSave using NewName for the Filename:= parameter, as:
Filename:=NewName


"Rita" wrote:

I figured it out! Now I need to know how to name the file a different name
than the original and save it as a new one. Does anyone know the code for
this? Thanks.

"Rita" wrote:

I am somewhat familiar with macros and understand how to record one. I am
using Excel 2007. I am trying to create a macro: (file, save as, "file
name", and then have Excel finish with the "save" function), but I keep
getting the following error message. Please help! Thanks.

"the following features cannot be saved in macro-free workbooks: VB
project. To save a file with these features, click no and then choose a
macro enabled file type in the file list. To continue saving as a macro-free
workbook click yes."

I have already chosen "enable all macros" in the trust center.

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
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 3 February 5th 07 08:22 PM
using a cell value to control a counter inside a macro and displaying macro value ocset Excel Worksheet Functions 1 September 10th 06 05:32 AM


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