View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
John Michl[_2_] John Michl[_2_] is offline
external usenet poster
 
Posts: 27
Default Programming behind a button

One method would be to add the button to the tool bar. I believe Save to
Web has it's own button. This would need to be set on each PC or the file
would need code that would add the button when it is opened.

Another method would be to record a macro of you doing the key strokes and
then attach that maco to a button or shape. To record a macro, selecect
Tools, Macro, Record Macro, name it if you wish, record the keystrokes then
stop the recording by clicking on the square stop button. On your
worksheet, add a button, a shape or add a picture. Then right click on it
and select Assign Macro. Choose the macro you recorded and that should do
it.

FYI - this is the code that was created when I recorded the macro. Note
that this method "hard codes" the file name. If you want to prompt the user
for a new file name, you'll need some more code.

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 7/18/2003 by John A Michl
'

'
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\John\My Documents\Book1.htm",
FileFormat:=xlHtml, _
ReadOnlyRecommended:=False, CreateBackup:=False
End Sub

Good luck
John Michl
www.johnmichl.com


"DRE" wrote in message
...
I need to have a button in an execl file that when clicked
will save the modifications made and then save the file as
an html file on a server to be viewed as a web page. I
know that all you have to do is click "save as html" but
we don't want the users to have to learn to do that.

Thanks in advance for any help.