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

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

hateexcel

New Member
Joined
Jul 16, 2002
Messages
31
unfortunately, that doesnt work.
(i put it in just before the call command)
 

Ian Mac

MrExcel MVP
Joined
Feb 20, 2002
Messages
1,174
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.
 

Forum statistics

Threads
1,143,640
Messages
5,719,984
Members
422,256
Latest member
downeybm

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
Top