Link to home
Start Free TrialLog in
Avatar of DCRAPACCESS
DCRAPACCESS

asked on

vba xlsm open hidden

Hi Experts

I have a xlsm file with some code inside. I would like to open the xlsm file. Then the code inside the xlsm file is running, and the xlsm file will save and close it self. As it is now i'm opening the file like this:
Application.FollowHyperlink "C:\UK\PP_BF.xlsm"
But the I get a message box the ask me if i want to open the file. I don't want this box to appear, and if possible the excel file should be open hidden.

Can someone help me with this?  
Avatar of Stephan_Schrandt
Stephan_Schrandt
Flag of Germany image

With following the hyperlink you give the control to system. Try this (you can change xlApp.Visible to false later) , but please note the application will not exit, so if the excel sheet does not quit the application then the excel process stays in memory.

Dim xlBook  As Object
Dim xlApp   As Object

Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open( "C:\UK\PP_BF.xlsm")
xlApp.Visible = true
Set xlApp = Nothing
Set xlBook = Nothing
Use:

Set xlBook = xlApp.Workbooks.Open( "C:\UK\PP_BF.xlsm",,False)

to open it in read write mode
Avatar of DCRAPACCESS
DCRAPACCESS

ASKER

just to be sure, the code inside the excel file, will it run and be done before the code continues and set the xlBook and xlApp to nothing?
ASKER CERTIFIED SOLUTION
Avatar of Stephan_Schrandt
Stephan_Schrandt
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial