Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Calling Excel File Save As Dialog

According to articles from Google, I have the following code to call
the "Save As" dialog from Excel.

Everything is working fine with my Excel object. I have copied a
recordset to a spreadsheet and now want to save it.

However, this line generates the Run-time error 1004:
Application-defined or object-defined error.

xlApp.Dialogs(xlDialogSaveAs).Show

Is something wrong with my code?

Here is the code that sets up my Excel objects:
Dim xlApp As Object
Dim xlBook As Object
Dim xlSheet As Object

Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)

I'm not sure of the difference between setting up my objects this way
verus using the Excel Object library. Could someone also explain that
difference to me and why there are two methods?

Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Calling Excel File Save As Dialog

try it this way

xlApp.Dialogs(5).Show


--
Regards,
Tom Ogilvy


"Bookreader" wrote:

According to articles from Google, I have the following code to call
the "Save As" dialog from Excel.

Everything is working fine with my Excel object. I have copied a
recordset to a spreadsheet and now want to save it.

However, this line generates the Run-time error 1004:
Application-defined or object-defined error.

xlApp.Dialogs(xlDialogSaveAs).Show

Is something wrong with my code?

Here is the code that sets up my Excel objects:
Dim xlApp As Object
Dim xlBook As Object
Dim xlSheet As Object

Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)

I'm not sure of the difference between setting up my objects this way
verus using the Excel Object library. Could someone also explain that
difference to me and why there are two methods?

Thank you.

  #3   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Calling Excel File Save As Dialog

I think your issue is due to using late binding for xlApp. The program can't
make sense of the constant xldialogsaveas because there is no reference set
up to Excel. I had a similar issue w/Word - which was resolved and explained
by Peo Sjoblom (for which I am still grateful). As Tom posted, you must use
the numerical value of that constant. Or, set up a reference to Excel under
Tools/References and use early binding.



"Bookreader" wrote:

According to articles from Google, I have the following code to call
the "Save As" dialog from Excel.

Everything is working fine with my Excel object. I have copied a
recordset to a spreadsheet and now want to save it.

However, this line generates the Run-time error 1004:
Application-defined or object-defined error.

xlApp.Dialogs(xlDialogSaveAs).Show

Is something wrong with my code?

Here is the code that sets up my Excel objects:
Dim xlApp As Object
Dim xlBook As Object
Dim xlSheet As Object

Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)

I'm not sure of the difference between setting up my objects this way
verus using the Excel Object library. Could someone also explain that
difference to me and why there are two methods?

Thank you.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Calling Excel File Save As Dialog

On Thu, 13 Jul 2006 17:41:01 -0700, JMB
wrote:

I think your issue is due to using late binding for xlApp. The program can't
make sense of the constant xldialogsaveas because there is no reference set
up to Excel. I had a similar issue w/Word - which was resolved and explained
by Peo Sjoblom (for which I am still grateful). As Tom posted, you must use
the numerical value of that constant. Or, set up a reference to Excel under
Tools/References and use early binding.



Thanks.
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
Save file dialog box in Excel falcios Excel Discussion (Misc queries) 4 February 12th 07 08:29 PM
How to not show save dialog after reading from excel file. philg1984 Excel Programming 1 February 13th 06 08:41 PM
How do you disable save file dialog? someone Setting up and Configuration of Excel 2 February 13th 05 12:02 AM
Filename has Url in file-save dialog when saving exported Excel do GJones Excel Programming 0 September 1st 04 08:17 PM
Close file without Save Changes dialog box flumpf Excel Programming 1 October 24th 03 02:38 AM


All times are GMT +1. The time now is 06:30 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"