Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programming behind a button
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programming behind a button
DRE,
The easy way is to "record" a macro to do exactly what you want. Tools/Macro/Record New Macro When done, use a CommandButton from the "Forms" menu View/Toolbars/Forms When you drag the button to your worksheet, you'll be promted to assign a macro to it. Assign the one you just recorded. Every time the user presses the button, it'll do exactly what you recorded in the macro. John DRE wrote: 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Programming | Excel Discussion (Misc queries) | |||
vba programming | Excel Discussion (Misc queries) | |||
Counting, command button and programming in VB | Excel Discussion (Misc queries) | |||
Programming a "Save as..." command button within Excel | Excel Discussion (Misc queries) | |||
Programming help | Excel Discussion (Misc queries) |