Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How to capture Excel Save As dialog box?

My application is addin to Excel. I am trying to capture Excel Save and
Cancel buttons on Save As dialog box - so that I can call methods relevant to
my app depending on what user pressed. Is there a way to capture those events?

Thanks in advance!

--
Aruna
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 638
Default How to capture Excel Save As dialog box?

On May 9, 4:15 pm, Aruna Akella
wrote:
My application is addin to Excel. I am trying to capture Excel Save and
Cancel buttons on Save As dialog box - so that I can call methods relevant to
my app depending on what user pressed. Is there a way to capture those events?

Thanks in advance!

--
Aruna


Something like this what you're after?

Sub foo()
Dim saveName As String
saveName = Application.GetSaveAsFilename(fileFilter:="Excel Files
(*.xls), *.xls")
If saveName = False Or saveName = "" Then
MsgBox "No name entered or selected or canel button pressed"
Else
MsgBox saveName
End If
End Sub

HTH
-Jeff-

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How to capture Excel Save As dialog box?

this is showing Save (or Save As dialog box 2 times)... any idea on how to
disable them? I did try disabling events & also set cancel = true at the end
- so that it will show only one time, but this didn't help - it didn't save
the workbook...
--
Aruna


"JW" wrote:

On May 9, 4:15 pm, Aruna Akella
wrote:
My application is addin to Excel. I am trying to capture Excel Save and
Cancel buttons on Save As dialog box - so that I can call methods relevant to
my app depending on what user pressed. Is there a way to capture those events?

Thanks in advance!

--
Aruna


Something like this what you're after?

Sub foo()
Dim saveName As String
saveName = Application.GetSaveAsFilename(fileFilter:="Excel Files
(*.xls), *.xls")
If saveName = False Or saveName = "" Then
MsgBox "No name entered or selected or canel button pressed"
Else
MsgBox saveName
End If
End Sub

HTH
-Jeff-


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default How to capture Excel Save As dialog box?

The posted code will not display the dialog twice.

GetSaveAsFileName does not save the file, just asks the user for a file
name. The programmer has to handle saving the file.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Aruna Akella" wrote in message
...
this is showing Save (or Save As dialog box 2 times)... any idea on how to
disable them? I did try disabling events & also set cancel = true at the
end
- so that it will show only one time, but this didn't help - it didn't
save
the workbook...
--
Aruna


"JW" wrote:

On May 9, 4:15 pm, Aruna Akella
wrote:
My application is addin to Excel. I am trying to capture Excel Save and
Cancel buttons on Save As dialog box - so that I can call methods
relevant to
my app depending on what user pressed. Is there a way to capture those
events?

Thanks in advance!

--
Aruna


Something like this what you're after?

Sub foo()
Dim saveName As String
saveName = Application.GetSaveAsFilename(fileFilter:="Excel Files
(*.xls), *.xls")
If saveName = False Or saveName = "" Then
MsgBox "No name entered or selected or canel button pressed"
Else
MsgBox saveName
End If
End Sub

HTH
-Jeff-




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default How to capture Excel Save As dialog box?

One way would be the capture the BeforeSave event, test the SaveAsUI
parameter and if true, set Cancel to True and put up your own dialog.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting LLC
www.cpearson.com
(email on the web site)

"Aruna Akella" wrote in message
...
My application is addin to Excel. I am trying to capture Excel Save and
Cancel buttons on Save As dialog box - so that I can call methods relevant
to
my app depending on what user pressed. Is there a way to capture those
events?

Thanks in advance!

--
Aruna





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to capture Excel Save As dialog box?

I've been working on a similar procedure, and have used the method suggested
by Chip below.

I created a class and include the declaration in that class:
'Public WithEvents xlapp As Application'

I then create an instance of that class when ThisWorkbook is opened - the
technique Chip outlines on his very useful website.

It all works fine, unless I click on the stop button in the VBA editor, or
something similar, which destroys the object set up to capture the
application events.

Is there anyway around this?

Thanks.

Adrian.

"Chip Pearson" wrote:

One way would be the capture the BeforeSave event, test the SaveAsUI
parameter and if true, set Cancel to True and put up your own dialog.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting LLC
www.cpearson.com
(email on the web site)

"Aruna Akella" wrote in message
...
My application is addin to Excel. I am trying to capture Excel Save and
Cancel buttons on Save As dialog box - so that I can call methods relevant
to
my app depending on what user pressed. Is there a way to capture those
events?

Thanks in advance!

--
Aruna




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default How to capture Excel Save As dialog box?

I've never found a satisfactory way around this. I tend to insert calls to
the routine that creates the xlApp object in a lot of places, so the object
is assured of being around "most of the time". Then I also put a button that
explicitly recreates the object somewhere in the menu.

Generally this is less of a problem when my users are using the programs
than when I am, since they don't go messing about in the VB Editor, and they
don't go crashing lots of things. (My development environment is a mess.)

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Adrian Johnson, CA" <Adrian Johnson, wrote in
message ...
I've been working on a similar procedure, and have used the method
suggested
by Chip below.

I created a class and include the declaration in that class:
'Public WithEvents xlapp As Application'

I then create an instance of that class when ThisWorkbook is opened - the
technique Chip outlines on his very useful website.

It all works fine, unless I click on the stop button in the VBA editor, or
something similar, which destroys the object set up to capture the
application events.

Is there anyway around this?

Thanks.

Adrian.

"Chip Pearson" wrote:

One way would be the capture the BeforeSave event, test the SaveAsUI
parameter and if true, set Cancel to True and put up your own dialog.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting LLC
www.cpearson.com
(email on the web site)

"Aruna Akella" wrote in message
...
My application is addin to Excel. I am trying to capture Excel Save and
Cancel buttons on Save As dialog box - so that I can call methods
relevant
to
my app depending on what user pressed. Is there a way to capture those
events?

Thanks in advance!

--
Aruna






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to capture Excel Save As dialog box?

A shame there doesn't appear to be a way round it. Thanks for the advice
though Jon.

"Jon Peltier" wrote:

I've never found a satisfactory way around this. I tend to insert calls to
the routine that creates the xlApp object in a lot of places, so the object
is assured of being around "most of the time". Then I also put a button that
explicitly recreates the object somewhere in the menu.

Generally this is less of a problem when my users are using the programs
than when I am, since they don't go messing about in the VB Editor, and they
don't go crashing lots of things. (My development environment is a mess.)

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Adrian Johnson, CA" <Adrian Johnson, wrote in
message ...
I've been working on a similar procedure, and have used the method
suggested
by Chip below.

I created a class and include the declaration in that class:
'Public WithEvents xlapp As Application'

I then create an instance of that class when ThisWorkbook is opened - the
technique Chip outlines on his very useful website.

It all works fine, unless I click on the stop button in the VBA editor, or
something similar, which destroys the object set up to capture the
application events.

Is there anyway around this?

Thanks.

Adrian.

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
Excel screen capture to capture cells and row and column headings jayray Excel Discussion (Misc queries) 5 November 2nd 07 11:01 PM
Save file dialog box in Excel falcios Excel Discussion (Misc queries) 4 February 12th 07 08:29 PM
Save Excel Worksheet As CSV - No Save As Dialog SQLServant Excel Programming 1 September 29th 06 12:36 PM
Calling Excel File Save As Dialog Bookreader Excel Programming 3 July 14th 06 05:40 PM
how to get disk icon on save button of save as dialog like 2000 RichT Excel Discussion (Misc queries) 2 March 9th 06 08:13 PM


All times are GMT +1. The time now is 01:07 PM.

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"