Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello once again,
I am calling save via code as such if not activeworkbook.saved then activeworkbook.save in Workbook_BeforeSave, I make a string to be my filename as such sFileName="C:\Saveme.xls" Then I call the saveas routine as such ActiveWorkbook.SaveAs Filename:=sFileName, addtomru:=True, FileFormat:=xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, CreateBackup:=False And low and behold, nothing happens. However, when I click the save button from the toolbar, everything works fine. What is the difference? How can I perform the same save routine as the button click? Thanks. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ok, so I didn't know how to call the save directly from the toolbar so I
made this: 'Usage dim x as CommadBarButton set x = FindCommandButton("&Save") if not x is nothing then x.execute Function FindCommandButton(Caption As String) As CommandBarButton Dim cmdbar As CommandBar Dim cmdbtn As CommandBarButton Dim cmdctl As CommandBarControl For Each cmdbar In Application.CommandBars For Each cmdctl In Application.CommandBars(cmdbar.Name).Controls If cmdctl.Type = msoControlButton Then Set cmdbtn = cmdctl If cmdbtn.Caption = "&Save" Then Set FindSave = cmdbtn Exit Function End If End If Next cmdctl Next cmdbar End Function It seems to work pretty well "AMDRIT" wrote in message ... Hello once again, I am calling save via code as such if not activeworkbook.saved then activeworkbook.save in Workbook_BeforeSave, I make a string to be my filename as such sFileName="C:\Saveme.xls" Then I call the saveas routine as such ActiveWorkbook.SaveAs Filename:=sFileName, addtomru:=True, FileFormat:=xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, CreateBackup:=False And low and behold, nothing happens. However, when I click the save button from the toolbar, everything works fine. What is the difference? How can I perform the same save routine as the button click? Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Calling a Sub from another | Excel Programming | |||
Need Help using/calling a DLL | Excel Programming | |||
Need Help Using/Calling DLL Please | Excel Programming | |||
Totally Disabling (^ save ) (Save as) and Save Icon – Which code do I use: | Excel Programming | |||
Calling an Add-In | Excel Discussion (Misc queries) |