ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Addin to open and hide a workbook (https://www.excelbanter.com/excel-programming/416218-addin-open-hide-workbook.html)

aehan

Addin to open and hide a workbook
 
Hello all

I am trying to make an Addin to be distributed between several users. The
Addin will open and hide a workbook with macros. in the same way as Personal
Macro Workbook. My problem is that althought the addin works, the code I
wrote hides all of the windows, not just the workbook I want to hide, and
when I reference the workbook itself I get a run time error 9. The code I
have so far is:

Sub Open_and_Hide_Macros()

Set newBook = Workbooks.Open("C:\Documents and Settings\My
Documents\Excel\Practice\MyMacros.xls")
Windows("C:\Documents and Settings\My
Documents\Excel\Practice\MyMacros.xls").Visible = False

End Sub

Can anyone help please.

Thank you
Aehan

aehan

Addin to open and hide a workbook
 
Hello again

I solved it myself. It was a silly question I know, but I had reached the
point of hair tearing and had bogged myself down without thinking it through
properly. Apologies for asking a silly question.

Thanks
Aehan


"aehan" wrote:

Hello all

I am trying to make an Addin to be distributed between several users. The
Addin will open and hide a workbook with macros. in the same way as Personal
Macro Workbook. My problem is that althought the addin works, the code I
wrote hides all of the windows, not just the workbook I want to hide, and
when I reference the workbook itself I get a run time error 9. The code I
have so far is:

Sub Open_and_Hide_Macros()

Set newBook = Workbooks.Open("C:\Documents and Settings\My
Documents\Excel\Practice\MyMacros.xls")
Windows("C:\Documents and Settings\My
Documents\Excel\Practice\MyMacros.xls").Visible = False

End Sub

Can anyone help please.

Thank you
Aehan



All times are GMT +1. The time now is 09:17 AM.

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