Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 237
Default Workbook Path

I need a code that will say:

If Workbook located in P:\QTD\Stats Manager.xls Worksheets
(4).Range("A1")=1 then msgbox "Upgrade" else msgbox "No
Upgrade"


How would I do this?

Thanx

Todd Huttenstine
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Workbook Path

Hi Todd

You can open the file with VBA and check the value.
With screenupdating to false it is fast and you don't see the file open and close.

Or use John's example to check a value in a closed file
http://j-walk.com/ss/excel/tips/tip82.htm



--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Todd Huttenstine" wrote in message ...
I need a code that will say:

If Workbook located in P:\QTD\Stats Manager.xls Worksheets
(4).Range("A1")=1 then msgbox "Upgrade" else msgbox "No
Upgrade"


How would I do this?

Thanx

Todd Huttenstine



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Workbook Path

Sub testit()
Dim wkb As Workbook

Set wkb = Workbooks.Open(Filename:="P:\QTD\Stats Manager.xls",
ReadOnly:=True)
If wkb.Worksheets(4).Range("A1") = 1 Then MsgBox "Upgrade" Else MsgBox
"No Upgrade"
wkb.Close SaveChange:=False
End Sub


"Todd Huttenstine" wrote in message
...
I need a code that will say:

If Workbook located in P:\QTD\Stats Manager.xls Worksheets
(4).Range("A1")=1 then msgbox "Upgrade" else msgbox "No
Upgrade"


How would I do this?

Thanx

Todd Huttenstine



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Workbook Path

The workbook cannot be opened to check it.
-----Original Message-----
Sub testit()
Dim wkb As Workbook

Set wkb = Workbooks.Open(Filename:="P:\QTD\Stats

Manager.xls",
ReadOnly:=True)
If wkb.Worksheets(4).Range("A1") = 1 Then

MsgBox "Upgrade" Else MsgBox
"No Upgrade"
wkb.Close SaveChange:=False
End Sub


"Todd Huttenstine"

wrote in message
...
I need a code that will say:

If Workbook located in P:\QTD\Stats Manager.xls

Worksheets
(4).Range("A1")=1 then msgbox "Upgrade" else msgbox "No
Upgrade"


How would I do this?

Thanx

Todd Huttenstine



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default Workbook Path

Take a look at John Walkenbach's

A VBA Function to Get a Value From a Closed File
http://j-walk.com/ss/excel/tips/tip82.htm

it should be able to be adapted for your needs.

In article ,
"Todd Htutenstine" wrote:

The workbook cannot be opened to check it.
-----Original Message-----
Sub testit()
Dim wkb As Workbook

Set wkb = Workbooks.Open(Filename:="P:\QTD\Stats

Manager.xls",
ReadOnly:=True)
If wkb.Worksheets(4).Range("A1") = 1 Then

MsgBox "Upgrade" Else MsgBox
"No Upgrade"
wkb.Close SaveChange:=False
End Sub


"Todd Huttenstine"

wrote in message
...
I need a code that will say:

If Workbook located in P:\QTD\Stats Manager.xls

Worksheets
(4).Range("A1")=1 then msgbox "Upgrade" else msgbox "No
Upgrade"


How would I do this?

Thanx

Todd Huttenstine



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Workbook Path

Hi Todd

Another approach might be to use a free cell, enter a formula in it pointing to the
file/sheet/cell, calculate, remove the formula. Something like:

Sub GetTheThing()
On Error GoTo None
Sheets(1).Cells(1, 1).FormulaR1C1 = _
"='P:\QTD\[Stats Manager.xls]Sheet4'!R1C1"
Sheets(1).Cells(1, 1).Calculate
Sheets(1).Cells(1, 1).Value = _
Sheets(1).Cells(1, 1).Value
If Sheets(1).Cells(1, 1).Value = 1 Then
MsgBox "Upgrade"
Exit Sub
End If
None:
MsgBox "Never upgrade"
End Sub

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"Todd Huttenstine" wrote in message
...
I need a code that will say:

If Workbook located in P:\QTD\Stats Manager.xls Worksheets
(4).Range("A1")=1 then msgbox "Upgrade" else msgbox "No
Upgrade"


How would I do this?

Thanx

Todd Huttenstine



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
How to see full path name of open workbook? Joe User[_2_] Excel Discussion (Misc queries) 5 March 21st 10 08:29 PM
New Workbook Path exceluserforeman Excel Discussion (Misc queries) 2 December 7th 05 12:10 AM
Workbook path nc Excel Discussion (Misc queries) 2 April 4th 05 03:37 PM
Path where Workbook is saved Todd Huttenstine[_2_] Excel Programming 3 December 2nd 03 01:50 AM
how to open workbook without hardcoding path Michael Turner Excel Programming 3 November 20th 03 12:12 PM


All times are GMT +1. The time now is 07:07 PM.

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"