Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Kip Kip is offline
external usenet poster
 
Posts: 13
Default commandbutton removal

Please help,

When i do a saveas and sendmail; the new file contains the original command
button and the macro associated with the button, I want to remove to button
in the newly copied file during the saveas function. Any ideas?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default commandbutton removal

hi
you problem comes from the saveas that you are doing. this saves the file
under a different name along with the data , controls, macros and all else.
what you need to do is just save the range of data to a new workbook and
email that.
how?
paste this in a standard module. you can fire it from a worksheet button or
a toolbar icon.
Sub mac1SaveRange()

'Macro written by FSt1 4/27/00

Dim cnt As Long
Dim cell As Range
On Error GoTo err1

MsgBox "You have selected range" & Selection.Address
If Selection.Cells.Count = 1 Then
If MsgBox("You have selected only one cell. Continue?", vbYesNo,
"Warning") = vbNo Then
Exit Sub
End If
End If
cnt = 0
For Each cell In Selection
If Not IsEmpty(cell) Then
cnt = cnt + 1
End If
Next
If cnt = 0 Then
If MsgBox("There is no data in the selected range. Continue?!?!?!?!?",
vbYesNo, "Warning") = vbNo Then
Exit Sub
End If
End If
'ActiveSheet.UsedRange.Select
Selection.Copy
Workbooks.Add
Range("A1").PasteSpecial xlPasteAll
Application.Dialogs(xlDialogSaveAs).Show
err1:
MsgBox ("Need a range to save.")
Exit Sub
End Sub

Post back if you have questions
Regards
FSt1
"Kip" wrote:

Please help,

When i do a saveas and sendmail; the new file contains the original command
button and the macro associated with the button, I want to remove to button
in the newly copied file during the saveas function. Any ideas?

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
Removal of Zero vmohan1978 Excel Worksheet Functions 4 January 24th 10 07:29 AM
function removal Joytrink Excel Discussion (Misc queries) 3 January 29th 09 08:49 PM
.xla removal Coza Excel Programming 9 April 10th 07 02:31 AM
Number removal Jennings Excel Worksheet Functions 4 February 15th 06 04:56 PM
Add-in removal Rob Hoffy Excel Programming 4 April 8th 05 03:42 AM


All times are GMT +1. The time now is 08:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"