Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have this code which when a cell is selected loads up a certain wor
file. All the word files are stored in the same folder. Currently, whe a cell is selected an option is shown which asks the user if they wan to view the word file for that cell. The problem I have is that whe Yes is selected, the code doesn't load up the word file I want, i wants to load up the document named 'Target'. Do I have to declare thi 'Target' a variable. Very confused, any help would be great. The code have is below: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim intResponse As Integer Dim WrdApp As Object Set WrdApp = CreateObject("Word.Application") ' Determines whether the cell has a BOM# within it If Left(Target, 3) = "BOM" Then ' Displays a message box allow with options intResponse = MsgBox("Would you like to open " & Target & " ?" vbYesNo) ' Selects the outcome if Yes is chosen If intResponse = vbYes Then ' Opens word file With WrdApp .Documents.Open Filename:="S:\Technical\Target" ReadOnly:=True End With WrdApp.Visible = True End If End I -- Message posted from http://www.ExcelForum.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Declaring variables | Excel Discussion (Misc queries) | |||
Declaring variables | Excel Discussion (Misc queries) | |||
Declaring Variables | Excel Programming | |||
Declaring variables | Excel Programming | |||
Declaring Variables | Excel Programming |