Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default IE to Book1, to book2, then close Book1.xls


Greetings,

I am trying to link (web link) to an Excel file (Book1.xls) that will
open another Excel file (Book2.xls) then close itself (Book1.xls). It
will work when I run just Book1.xls but if I load it through IE as a
link, it does not seem to want to work (asks to save the file or opens
book1.xls twice, or out of memory errors).

I basically want to use Book1.xls to determine where to load book2.xls
(either from the Web or from the local PC).

Here is the code that I have for Book1.xls:


Sub auto_open()

Dim xlApp As Excel.Application
Dim xlWB As Excel.Workbook
Dim i As Integer

Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True

Set xlWB = xlApp.Workbooks.Open("c:\Book2.xls")

Set xlApp = Nothing
Set xlWB = Nothing

Excel.Application.ThisWorkbook.Saved = True
Excel.Application.Quit

End Sub


Any ideas?


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 132
Default IE to Book1, to book2, then close Book1.xls

GotDebt;

If your book1 is already on a PC then you do not need to
do the creat object because you are already in it. Just
use Workbooks.Open("yourpath")

At the end put in this line to get it to stop asking the
question.

Application.DisplayAlerts=False

Also if book2 is opened and you want book1 to close out
you can use

ThisWorkBook.Close after the alerts are disabled.

Thanks,

Greg



-----Original Message-----

Greetings,

I am trying to link (web link) to an Excel file

(Book1.xls) that will
open another Excel file (Book2.xls) then close itself

(Book1.xls). It
will work when I run just Book1.xls but if I load it

through IE as a
link, it does not seem to want to work (asks to save the

file or opens
book1.xls twice, or out of memory errors).

I basically want to use Book1.xls to determine where to

load book2.xls
(either from the Web or from the local PC).

Here is the code that I have for Book1.xls:


Sub auto_open()

Dim xlApp As Excel.Application
Dim xlWB As Excel.Workbook
Dim i As Integer

Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True

Set xlWB = xlApp.Workbooks.Open("c:\Book2.xls")

Set xlApp = Nothing
Set xlWB = Nothing

Excel.Application.ThisWorkbook.Saved = True
Excel.Application.Quit

End Sub


Any ideas?


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from

http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step

guide to creating financial statements
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default IE to Book1, to book2, then close Book1.xls


Greg,

Actually Book1.xls contains the macro and is on the web as a link. Th
user clicks the link www..../book1.xls, IE loads Excel then th
Book1.xls has this macro in it.

I think I already tried it using your method to open book2.xls...
But I'll try it after lunch and let you know what happens...

Thanks,
Joh

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default IE to Book1, to book2, then close Book1.xls


I tried the following, but I can still see the project for Book1.xl
after it is closed (out of memory errors occur if any macros are run i
Book2.xls):

Sub auto_open()

Dim xlWB As Excel.Workbook
Set xlWB = Excel.Workbooks.Open("c:\Book2.xls")


Application.DisplayAlerts = False
Excel.Application.ThisWorkbook.Saved = True
Windows("Book1.xls").Close False
Set xlWB = Nothing


End Sub


Any ideas

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements
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
VBA - Testing for Book1, Book2 etc. dhstein Excel Discussion (Misc queries) 1 May 22nd 09 10:12 AM
Transfer info book1 to book2 israel New Users to Excel 3 January 23rd 09 07:14 PM
Automatically Close Book1 Dave486 Excel Discussion (Misc queries) 0 April 26th 08 11:47 PM
Book1 and Book2 JohnR Excel Discussion (Misc queries) 2 July 6th 07 02:10 AM
=SUMIF(book2!L3:AF3, "=book1!O30", book2!L20:AF20) dond Excel Discussion (Misc queries) 1 November 8th 05 12:33 PM


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