ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Open a workbook (https://www.excelbanter.com/excel-programming/327137-open-workbook.html)

Virginia

Open a workbook
 
I have this code in a workbook called "MAINWORKBOOK.XLS that opens another
excel file called "Ledger.xls". the code does one thing, add a new worksheet
to ledgers.xls.

Sub AddLedger()
Application.ScreenUpdating = False
Workbooks.Open Filename:=ThisWorkbook.Path & "\Ledger.xls"
With ActiveWorkbook
.Sheets.Add
End With
ActiveWindow.Visible = False
Workbooks("MAINWORKBOOK.XLS").Activate
Application.ScreenUpdating = True
End Sub

AS you can see the code opens the workbook, then hides it. is there any way
other than this to have it open the workbook already hidden so you do not see
a little blip on the windows bar at the bottom of the screen? thank you in
advance.

Don Guillett[_4_]

Open a workbook
 
I just created a worbooknamed it mhwb.xlshid itrecorded this macro.

Sub Macro2()
'
' Macro2 Macro
' Macro recorded 4/9/2005 by Don Guillett
'

'
Workbooks.Open Filename:="C:\PERSONAL\mhwb.xls"
Sheets.Add Type:="Worksheet"
ActiveWorkbook.Save
ActiveWindow.Close
End Sub

--
Don Guillett
SalesAid Software

"Virginia" wrote in message
...
I have this code in a workbook called "MAINWORKBOOK.XLS that opens another
excel file called "Ledger.xls". the code does one thing, add a new

worksheet
to ledgers.xls.

Sub AddLedger()
Application.ScreenUpdating = False
Workbooks.Open Filename:=ThisWorkbook.Path & "\Ledger.xls"
With ActiveWorkbook
.Sheets.Add
End With
ActiveWindow.Visible = False
Workbooks("MAINWORKBOOK.XLS").Activate
Application.ScreenUpdating = True
End Sub

AS you can see the code opens the workbook, then hides it. is there any

way
other than this to have it open the workbook already hidden so you do not

see
a little blip on the windows bar at the bottom of the screen? thank you

in
advance.





All times are GMT +1. The time now is 07:19 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com