macro free workbook saves macro

J

jat

im using office 2007, i record a macro of the current workbook (create a copy
of a the worksheet, and save it as a macro free workbook.) the macro is
assigned to a picture on the same worksheet.

when i open the newly created workbook of the worksheet, and click the
picture, the macro is available and it runs. when i look in the code modules
for the new workbook, the macro is not listed anywhere.

the code from when i create a copy of the one sheet is as follows:

'copy sheet, and save as new workbook
Sheets("Purchase Order (Inventory)").Select
Sheets("Purchase Order (Inventory)").Copy
ActiveWorkbook.SaveAs Filename:=Range("H7").Value & Range("H6").Value &
"\" & _
Format(Now, "yyyy-mm-dd, ") & "PO# " & Range("M5").Value & ", Claim
(" & Range("H6").Value & ").xlsx", FileFormat:=xlOpenXMLWorkbook,
CreateBackup:=False
ActiveSheet.Unprotect Password:="*******"

' remove sourced information, and replace it with actual values
Range("H5:K7").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("H8:K9").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("H5:K5").Select
Selection.Locked = True
Selection.FormulaHidden = False

ActiveWorkbook.Save

ActiveSheet.Protect Password:="*******", DrawingObjects:=True,
Contents:=True, Scenarios:=True
ActiveWorkbook.Save
ActiveWindow.Close
at this point i am returned back to my original file.

is there anything that i am missing?

jat
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top