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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Block Word from opening an Excel spreadsheet

Status
Not open for further replies.

grannyM

Programmer
Nov 26, 2002
39
0
0
US
We have a few users that continually open an excel spreadsheet in word even though they get the extra box that tells them it’s a spreadsheet. Then when they see it’s not what they want, instead of just closing it, they save it, and destroy the spreadsheet. Is there any way to turn off the feature in word that allows them to open the spreadsheet and converts it to a table?
 
I am not clear on exactly what they are doing. Opening the speadsheet, and converting it to table are two different instructions.

Open:
Code:
Selection.InlineShapes(1).OLEFormat.DoVerb VerbIndex:=1

Convert:
Code:
   If Selection.Type = wdSelectionShape Then
      Selection.ShapeRange(1).ConvertToInlineShape.Select
   End If
   Selection.InlineShapes(1).OLEFormat.ConvertTo ClassType:="Excel.Sheet.8", _
      DisplayAsIcon:=False

and I am not sure how to override, or block, either.

Gerry
 
sorry, they aren't doing anything through code. They are going to the File menu in Word, choosing open, then opening a spreadsheet file. (Filename.xls) Word then pops up a dialog box titled "Open Worksheet" where they could cancel if they were awake, but they click ok. Then when Word opens the file, Word changes the file to a table format automatically. The user sees that it's the wrong file, closes the file and clicks on yes when it asks if they want to save the file. Again, if they'd just click on no, we'd be ok.

I could add a procedure to normal.dot to hijack the FileOpen command and if the last 3 charcters of the filename are xls, just close the file and throw up an error message. But I was hoping that there was a way to just turn off the feature of Word that throws up the dialog box "Open Worksheet" and would instead give an error message.
 
For so uneducated users wordpad is the safest way ;-)
 
Agreed. If the users are that...hmmmmm, what is the most polite way?....anyway, if it is that bad, then yes, I think you should hijack FileOpen.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top