I am creating an Excel 2007 add-in using Visual Studio 2008 and I have a Windows Form that allows a user to select a date. What I want to do is store that date in the Workbook that the user saves so that the plug-in can reference that date programatically without the user having to constantly enter the date. Anyone else done this before?


7 Years
Discussion Span
Last Post by TomW

Anyone else done this before?

I did not work in excel plug-in or know how it works but you can use this to hide the sheet

Imports Excel = Microsoft.Office.Interop.Excel

Dim ex As new Excel.Application
Dim wb As Excel.Workbook
Dim ws As Excel.Worksheet
wb = ex.Workbooks.Open("c:\test.xls")
ex.Visible = True
ws = wb.Sheets("sheet1") ' change the name that you want to hide
ws.Visible = Excel.XlSheetVisibility.xlSheetVeryHidden  ' Read the comment The user cannot un-hide this sheet
debug.Print (ws.Range("A1").Value) ' You can still read value from it

You can do this by creating a macro in Excel itself but then it kinda defeats your VB plug-in...

Cheat Tip:
When trying to figure out VB syntax for automating Excel, I'll set it to record a macro and then perform whatever function I want. Then all I have to do is stop the macro, open it up for editing and steal the syntax.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.