UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Open a second excel file when the first one opens?    
 
   
Enigma007x
post Aug 5 2004, 09:01 AM
Post #1

UtterAccess Addict
Posts: 176



Heya-

I am using data from a second excel file in my main file. Is there a way I can open an excel file minimized in the background when the first one opens? And if so, can I then close it when the main one closes?

Thanks
Enigma
Go to the top of the page
 
+
dannyseager
post Aug 5 2004, 09:20 AM
Post #2

UtterAccess VIP
Posts: 13,031
From: Leicester, UK



open the excel file, fress Alt + F11 to get into the VBA editor.

In the project pane double click on "this workbook"

Then change the first drop down menu from general to workbook and make sure the second one says open

add the following code

CODE
  Workbooks.Open Filename:="C:\filename.xls"


add the folowing code to the before close event for the workbook

CODE
Application.ScreenUpdating = False
    Windows("filename").Activate
    ActiveWindow.Close
    Application.ScreenUpdating = True


The close routine is probably the long way round but it works
Go to the top of the page
 
+
Enigma007x
post Aug 5 2004, 09:45 AM
Post #3

UtterAccess Addict
Posts: 176



Great thanks!
Go to the top of the page
 
+
Enigma007x
post Aug 5 2004, 09:47 AM
Post #4

UtterAccess Addict
Posts: 176



Hmmm. I seem to just be able to pull up "Worksheet" and "General". Worksheet doesn't have an "Open" event and I can't seem to access the workbook.

ANy thoughts?
Go to the top of the page
 
+
Enigma007x
post Aug 5 2004, 09:51 AM
Post #5

UtterAccess Addict
Posts: 176



I'm an idiot. Found it in the Project Explorer as you had directed me (IMG:http://www.utteraccess.com/forum/style_emoticons/default/tongue.gif) Thanks Again!
Go to the top of the page
 
+
Enigma007x
post Aug 5 2004, 09:57 AM
Post #6

UtterAccess Addict
Posts: 176



Okay... Yes, I need to lay off the coffee... (IMG:http://www.utteraccess.com/forum/style_emoticons/default/tongue.gif) I put the Workbooks.Open code in the open event of the workbook, but nothing appears to be running in terms of VBA. :( I tried just throwing a Msgbox "Hi" in with no results as well.

I have done quite a bit with Access, but I just started working with Excel. Do I have to enable the VB somehow?

Again, I appreciate everything!
Enigma
Go to the top of the page
 
+
Luceze
post Aug 5 2004, 04:14 PM
Post #7

UtterAccess VIP
Posts: 2,601
From: Dallas, Texas USA



Go to tools/Macro/Security and set it to medium. If it is set to High the code will not run. If it is set to Low then anything will run.

HTH,
Eric
Go to the top of the page
 
+
dannyseager
post Aug 6 2004, 03:35 AM
Post #8

UtterAccess VIP
Posts: 13,031
From: Leicester, UK



did what "Jay & Silent Bob" Suggest work? (IMG:http://www.utteraccess.com/forum/style_emoticons/default/frown.gif)

if not let me know
Go to the top of the page
 
+
Enigma007x
post Aug 9 2004, 01:31 PM
Post #9

UtterAccess Addict
Posts: 176



Sorry for the delay in response.

It worked like a charm. Thank you both! (IMG:http://www.utteraccess.com/forum/style_emoticons/default/tongue.gif)
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 19th May 2013 - 09:29 AM