Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Referencing a cell


Hello Programmers,

This partial code opens a message box with a question before executing
a code.
Dim t As String
t = MsgBox("Are you sure you want to open the Chemistry sheet?",
vbYesNo)
If t = vbYes Then

How do I write code that pops up a message box like the one above, but
ask if I want to open the file name that is in "Cell A1". The code will
have to grab the file name from "Cell A1", and place it in the message
box.

Thanks,
EMoe


--
EMoe
------------------------------------------------------------------------
EMoe's Profile: http://www.excelforum.com/member.php...o&userid=23183
View this thread: http://www.excelforum.com/showthread...hreadid=498074

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 486
Default VBA Referencing a cell

if msgbox("Would you like to open file: " & Range("A1").value) = vbYes then
'Open the file...

By the way a message box returns a long, not a string... Not that it matters
with the above code...
--
HTH...

Jim Thomlinson


"EMoe" wrote:


Hello Programmers,

This partial code opens a message box with a question before executing
a code.
Dim t As String
t = MsgBox("Are you sure you want to open the Chemistry sheet?",
vbYesNo)
If t = vbYes Then

How do I write code that pops up a message box like the one above, but
ask if I want to open the file name that is in "Cell A1". The code will
have to grab the file name from "Cell A1", and place it in the message
box.

Thanks,
EMoe


--
EMoe
------------------------------------------------------------------------
EMoe's Profile: http://www.excelforum.com/member.php...o&userid=23183
View this thread: http://www.excelforum.com/showthread...hreadid=498074


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default VBA Referencing a cell

One way:

Dim nResult As Long
nResult = MsgBox( _
Prompt:="Are you sure you want to open file " & _
Range("A1").Text & "?", _
Buttons:=vbYesNo)
If nResult = vbYes Then
'Open the file
Else
'do something else
End If



In article ,
EMoe wrote:

Hello Programmers,

This partial code opens a message box with a question before executing
a code.
Dim t As String
t = MsgBox("Are you sure you want to open the Chemistry sheet?",
vbYesNo)
If t = vbYes Then

How do I write code that pops up a message box like the one above, but
ask if I want to open the file name that is in "Cell A1". The code will
have to grab the file name from "Cell A1", and place it in the message
box.

Thanks,
EMoe

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Referencing a cell


Thanks for the reply. I'm still analyzing the codes. May post another
question later.

EMoe


--
EMoe
------------------------------------------------------------------------
EMoe's Profile: http://www.excelforum.com/member.php...o&userid=23183
View this thread: http://www.excelforum.com/showthread...hreadid=498074

Reply
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
Referencing a Cell rhhince[_2_] Excel Worksheet Functions 3 January 2nd 08 02:50 AM
cell referencing Michael Excel Worksheet Functions 3 November 4th 07 01:21 PM
Referencing Cell Next To Today's Date Cell Docktondad Excel Discussion (Misc queries) 5 May 16th 07 10:25 PM
referencing a cell MIchel Khennafi Excel Worksheet Functions 3 September 8th 06 05:28 PM
referencing a name from a cell value name Excel Discussion (Misc queries) 1 July 3rd 06 03:55 AM


All times are GMT +1. The time now is 12:21 AM.

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

About Us

"It's about Microsoft Excel"