good morning--closing excel in VB

hateexcel

New Member
Joined
Jul 16, 2002
Messages
31
so, i open excel from access with the following macro:
Private Sub RunExcel()

Dim xlApp, xlBook As Object

Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add("q:ma_gruppenstudentenarberabensprotocolreading.xls")

xlApp.visible = True

xlApp.Application.Run "import"


Set xlApp = Nothing
Set xlBook = Nothing

Call TextDateiEinlesen

End Sub

where textdateieinlessen is a access macro.

how can i make excel close before the call command. is there a command i can put in the excel macro to close excel? or is there a command i can put in the above macro. eg:
xlApp.Close
which would be good but doesnt work
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
On 2002-10-02 04:04, hateexcel wrote:
unfortunately, that doesnt work.
(i put it in just before the call command)

I'm assuming the thing your calling isn't in Excel.

I've just used:

xlApp.Quit
Set xlApp = Nothing
Set xlBook = Nothing

Call cmbEmail_Click

and this works fine for me.
 
Upvote 0

Forum statistics

Threads
1,214,786
Messages
6,121,546
Members
449,038
Latest member
Guest1337

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top