Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
copied your code removed some even befor removal got error file not found. I
must be doing something wrong can not seem to locate error. Would you look at code and see if you can locate error. Noted in post reply that it worked fine. Thanks Option Explicit Sub test_Desc1() Dim oWord As Object Dim myWordDocName As String Dim testStr As String myWordDocName = "A:\desc.doc" testStr = "" On Error Resume Next testStr = Dir(myWordDocName) On Error GoTo 0 If testStr = "" Then MsgBox myWordDocName & " doesn't exist" Exit Sub End If On Error Resume Next Set oWord = GetObject(, "Word.Application") If Err.Number < 0 Then Set oWord = CreateObject("Word.Application") End If oWord.Visible = True oWord.Documents.Open myWordDocName, ReadOnly:=True Set oWord = Nothing End Sub "Dave Peterson" wrote: Maybe you could use a macro to open the document readonly. Option Explicit Sub testme() Dim oWord As Object Dim myWordDocName As String Dim testStr As String myWordDocName = "c:\my documents\word\test.doc" 'or even point to a name in the worksheet 'myWordDocName = ActiveSheet.Range("b1").Value testStr = "" On Error Resume Next testStr = Dir(myWordDocName) On Error GoTo 0 If testStr = "" Then MsgBox myWordDocName & " doesn't exist" Exit Sub End If On Error Resume Next Set oWord = GetObject(, "Word.Application") If Err.number < 0 Then Set oWord = CreateObject("Word.Application") End If oWord.Visible = True oWord.Documents.Open myWordDocName, ReadOnly:=True Set oWord = Nothing End Sub You could use a button from the forms toolbar and assign it this macro. If you're new to macros, you may want to read David McRitchie's intro at: http://www.mvps.org/dmcritchie/excel/getstarted.htm cartman101 wrote: I have set up a hyperlink in Excel to pen a word file. However the word file is set to give the read only prompt with option of a password to modify the document. I want to open the file read only but would prefer not to have the dialoge box when the file is opened from within Excel. Is there any way to modify the Hyperlink to allow this? Alternate methods of achieving the same outcome are always welcome. Regards Mike -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Retaining formats | Excel Discussion (Misc queries) | |||
Can not open excel file xls. extensions | Excel Discussion (Misc queries) | |||
cannot open excel file, please help!!! | Excel Discussion (Misc queries) | |||
Excel startup switches | Excel Discussion (Misc queries) | |||
Hyperlink in Excel 2000 can't open bookmarked Word 2000 file | Excel Discussion (Misc queries) |