Hi,

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?

Thanks

Recommended Answers

All 2 Replies

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.