Hi everyone, I got a simple question (at least I hope it's simple)

I have a VB app, I click a button, and all this data is output into excel (your typical excel automation project), once everything is done being created, the user has the option of right clicking on a cell with a date in it, and that will bring up a form from the vbapp with a datagrid control which will run a query, then they click close, and right click on a different cell (sure enough runs the same query)..works great...THE FIRST TIME.

My question: The 2nd time I run the app (click the button again, and yes excel is closed), my code runs great, it will do the same excel automation, however when right clicking on a cell with a date I get

"Run-time error 91 object variable or with block variable not set" and vb points to this line

VB Code:
  1. With ExcelData
  2.  
  3.       .ConnectionString = "DBQ=V:\shared\ChrisFischer\process1&2\WebPlanViewer.mdb;DefaultDir=V:\shared\ChrisFischer\process1&2;Driver={Microsoft Access-Treiber (*.mdb)};DriverId=25;FIL=MS Access;FILEDSN=C:\Program Files\Common Files\ODBC\Data Sources\MSAccessDatabaseConnection.dsn;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;SafeTransactions=0;Threads=3;UID=admin;UserCommitSync=Yes;"
  4.       .RecordSource = "SELECT MDSReport.PartNumber, MDSReport.MDSOriginalQty, MDSReport.Lineschdat, MDSReport.promiseDate, (MDSOriginalQty *( AssemblyResourceCost))/9.25 AS Hours " & _
  5.     "FROM MDSReport INNER JOIN TempManningForecast ON MDSReport.PartNumber = TempManningForecast.Item where Lineschdat = #" & ActiveCell.Value & "# ;"

and excelData is just a ADODC control...so it could be somewhere in here, or my thought is it's on this line here

Private Sub Sheet_BeforeRightClick(ByVal Target As Excel.Range, Cancel As Boolean)

with the excel.range causing the problem on the 2nd time, but I don't know how to reference that excel.range correctly because it's in a function call.

Any help on this issue would be greatly appreciated. Thanks for reading this long question. Thanks to all!