LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Declaring a variable?

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Declaring variables freekrill Excel Discussion (Misc queries) 2 July 19th 06 06:36 AM
Declaring variables freekrill Excel Discussion (Misc queries) 0 July 18th 06 06:15 PM
Declaring Variables Robert[_16_] Excel Programming 2 November 20th 03 04:16 PM
Declaring variables Pedro Excel Programming 1 November 13th 03 03:32 PM
Declaring Variables chris brunt Excel Programming 2 August 4th 03 02:02 PM


All times are GMT +1. The time now is 08:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"