Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determining how Excel was started

Status
Not open for further replies.

Deniall

Technical User
May 15, 2011
252
Australia
Does anyone know how to use Excel's VBA to determine how a workbook was opened by its user?[ ] I need to know whether my remote user opened his workbook by double-clicking upon the workbook file in File Explorer, or by first firing up Excel and then using its File>Open menu item.

(Please resist the temptation to suggest I simply ask him.[ ] I have, and it didn't help.)
 
There is also the tasklist - Start/Excel/Workbook.
 
I don't know that method of starting.[ ] Could you please elaborate.
But please don't tell my remote user about it.
 
If you state what is the problem, why do you need to know how Excel was open, there may be another fix. Who knows…?


---- Andy

There is a great need for a sarcasm font.
 
You ask, you get.

The problem is that I have a problem with a problem remote user who has reported a weird problem with a fairly complicated, VB-rich, spreadsheet I developed for his employing company.[ ] This employee works in a one-person office a thousand kilometres from his employer's head office, and I live across a large city from this headquarters.[ ] The head office USED to have a person who was IT-literate, but no longer.

They recently "updated" their file system to something that might (or might not) involve some combination of OneDrive, SharePoint, and (I think) something with a name like FileCentre.[ ] As a person who works alone, at home, with a simple stand-alone computer, I know nothing about any of these.[ ] And it seems neither do they.[ ] Every aspect of the spreadsheet works perfectly on my system.[ ] In normal times I would travel across town to their office, sit at one of their standard computers, and dig in.[ ] But the entire country (planet?) is in WuhanVirus-induced lockdown, so that is impossible.

Plan D is to create a simple spreadsheet that basically uses VBA to extract as much information as possible about the operating environment and report it to the remote user, for him to pass back to me.[ ] I send him that spreadsheet, get him to store it in exactly the same manner and location as the troublesome spreadsheet, then run it.

One aspect of the "operating environment" I am interested in is the way he is firing up the spreadsheet.[ ] Hence my starting post yesterday.

Why am I interested in this aspect, I hear you ask.[ ] Because a couple of years ago this company had another problem with the spreadsheet.[ ] I could not reproduce the problem.[ ] After a lot of too-ing and fro-ing I discovered that I was always starting the spreadsheet one way and they were always starting it the other way.[ ] The problem's occurrence depended on the starting method.[ ] Once I knew that, it was easily solved.

 
If the problem is here and the workbook can be open by code, you can try to password-protect the workbook, create master workbook that opens it (FileDialog can be used to point location), protect from 'save as' user action and possible password change by:
[pre]Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If SaveAsUI = True Then
Cancel = True
ThisWorkbook.Save
End If
End Sub[/pre]
There may be a simpler solution, I would ask for screenshots and try to find the origin of this issue, that can be different from the opening method.

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top