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: 1
Default Button looses Macro setting when running Macro

The code below was intended to export a sheet from Excel into a new workbook
when a button is entered, then save and close the new workbook and return to
the original workbook.

This code ran without issue in Excel 2003 but with 2007 after the new book
is made, saved and closed, the macro button in the original book and all the
buttons with macros assigned in the orginal book dont work.

It seems that each button thinks their macro is associated with the new
workbook that was created and the path to the macro in the original was
changed. I have tried to find an answer or a workaround for this but have
had no luck.

Would anyone be able to offer me any advice?

Dule

Sub ExportSheet1()
'
ThisWorkbook.Activate
Sheets("Sheet1").Select

Sheets("Sheet1").Copy Befo=Sheets("Sheet1")

Sheets("Sheet1 (2)").Select
Sheets("Sheet1 (2)").Move
Range("B1").Select

SaveExportedSheet1
ThisWorkbook.Activate

End Sub

Sub SaveExportedSheet1()

fileSaveName = Application.GetSaveAsFilename( _
fileFilter:="Excel Files (*.xlsm), *.xlsm")

If fileSaveName < False Then
ActiveWorkbook.Save
ActiveWorkbook.Close
Else: Cancel = True

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
Stop running macro button, like Ctrl-Break button h2fcell Excel Programming 8 January 23rd 09 04:01 PM
Stop running macro button, like Ctrl-Break button Dave Peterson Excel Programming 1 January 22nd 09 05:23 PM
Stop running macro button, like Ctrl-Break button Ronald R. Dodge, Jr.[_2_] Excel Programming 0 January 22nd 09 04:59 PM
Running a Macro through a button vs. VBA [email protected] Excel Discussion (Misc queries) 2 August 31st 07 08:00 PM
excel to html looses button and macro, why? Kelly Mayo Excel Discussion (Misc queries) 0 October 7th 05 07:09 PM


All times are GMT +1. The time now is 06:34 AM.

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"