Hidden Application

B

Brian McCavour

Im not sure if this is the right group to ask in but using VBA in autocad I
was to open an excel worksheet, enter some data, copy data to the clipboard,
then close excel withought the user being able to see excel open. Is this
possible ?
 
D

Dave Peterson

I used this code in MSWord and it worked ok.

Option Explicit
Sub testme()

Dim xlObj As Object
Dim xlWB As Object

Set xlObj = CreateObject("excel.application")
xlObj.Visible = True

Set xlWB = xlObj.workbooks.Open("C:\my documents\excel\book1.xls")

xlWB.worksheets("sheet1").Range("a1:b99").Copy

xlObj.DisplayAlerts = False
xlWB.Close False 'save changes
xlObj.DisplayAlerts = True
xlObj.Quit

Set xlWB = Nothing
Set xlObj = Nothing

End Sub

I'd leave the .visible True until you debugged your code. After that, it's
false.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top