Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Syntax for using the full path to get a value

I'm almost there, but I just can't get it quit right. I am try to get a
value from a cell using the full path to the file. This ain't working, but
it's close. What am I doing wrong?

Sub Test()
pName = "U:\ExcelFiles\ADI-JournalEntries\Current_Month\Advance-O&M_Cur.xls"
MsgBox pName & Sheets("Journal1").Range("R22")
End Sub




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Syntax for using the full path to get a value

Excel VBA doesn't support linking to closed workbooks like excel itself
does. John Walkenbach has documented a method that uses and Excel 4 macro
to in VBA to do this.

http://j-walk.com/ss/excel/tips/tip82.htm

you can possibly use ADO, but that would seem more appropriate for a data
table.

http://www.erlandsendata.no/english/vba/adodao/

Andy Wiggins recently suggest sql.request

This might be a help for getting data to and from Excel and Access: It
includes examples of using variables in SQL queries.
http://www.bygsoftware.com/examples/sql.html

Or you can get there from the "Excel with Access Databases" section on page:
http://www.bygsoftware.com/examples/examples.htm

It demonstrates how to use SQL in Excel's VBA to:

* create a database,
* create a table and add data to it,
* select data from a table,
* delete a table,
* delete a database.

You can also download the demonstration file called "excelsql.zip".

The code is open and commented.


--

Regards
Andy Wiggins
www.BygSoftware.com
===========================

--
Regards,
Tom Ogilvy


"Tommy Flynn" wrote in message
...
I'm almost there, but I just can't get it quit right. I am try to get a
value from a cell using the full path to the file. This ain't working,

but
it's close. What am I doing wrong?

Sub Test()
pName =

"U:\ExcelFiles\ADI-JournalEntries\Current_Month\Advance-O&M_Cur.xls"
MsgBox pName & Sheets("Journal1").Range("R22")
End Sub






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Syntax for using the full path to get a value

Thanks. I'll take a look.

Tommy Flynn

"Tom Ogilvy" wrote in message
...
Excel VBA doesn't support linking to closed workbooks like excel itself
does. John Walkenbach has documented a method that uses and Excel 4

macro
to in VBA to do this.

http://j-walk.com/ss/excel/tips/tip82.htm

you can possibly use ADO, but that would seem more appropriate for a data
table.

http://www.erlandsendata.no/english/vba/adodao/

Andy Wiggins recently suggest sql.request

This might be a help for getting data to and from Excel and Access: It
includes examples of using variables in SQL queries.
http://www.bygsoftware.com/examples/sql.html

Or you can get there from the "Excel with Access Databases" section on

page:
http://www.bygsoftware.com/examples/examples.htm

It demonstrates how to use SQL in Excel's VBA to:

* create a database,
* create a table and add data to it,
* select data from a table,
* delete a table,
* delete a database.

You can also download the demonstration file called "excelsql.zip".

The code is open and commented.


--

Regards
Andy Wiggins
www.BygSoftware.com
===========================

--
Regards,
Tom Ogilvy


"Tommy Flynn" wrote in message
...
I'm almost there, but I just can't get it quit right. I am try to get a
value from a cell using the full path to the file. This ain't working,

but
it's close. What am I doing wrong?

Sub Test()
pName =

"U:\ExcelFiles\ADI-JournalEntries\Current_Month\Advance-O&M_Cur.xls"
MsgBox pName & Sheets("Journal1").Range("R22")
End Sub








  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Syntax for using the full path to get a value

Unless you wanted to open the file and get the value.

--
Regards,
Tom Ogilvy

"Tommy Flynn" wrote in message
...
Thanks. I'll take a look.

Tommy Flynn

"Tom Ogilvy" wrote in message
...
Excel VBA doesn't support linking to closed workbooks like excel itself
does. John Walkenbach has documented a method that uses and Excel 4

macro
to in VBA to do this.

http://j-walk.com/ss/excel/tips/tip82.htm

you can possibly use ADO, but that would seem more appropriate for a

data
table.

http://www.erlandsendata.no/english/vba/adodao/

Andy Wiggins recently suggest sql.request

This might be a help for getting data to and from Excel and Access: It
includes examples of using variables in SQL queries.
http://www.bygsoftware.com/examples/sql.html

Or you can get there from the "Excel with Access Databases" section on

page:
http://www.bygsoftware.com/examples/examples.htm

It demonstrates how to use SQL in Excel's VBA to:

* create a database,
* create a table and add data to it,
* select data from a table,
* delete a table,
* delete a database.

You can also download the demonstration file called "excelsql.zip".

The code is open and commented.


--

Regards
Andy Wiggins
www.BygSoftware.com
===========================

--
Regards,
Tom Ogilvy


"Tommy Flynn" wrote in message
...
I'm almost there, but I just can't get it quit right. I am try to get

a
value from a cell using the full path to the file. This ain't

working,
but
it's close. What am I doing wrong?

Sub Test()
pName =

"U:\ExcelFiles\ADI-JournalEntries\Current_Month\Advance-O&M_Cur.xls"
MsgBox pName & Sheets("Journal1").Range("R22")
End Sub










  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Syntax for using the full path to get a value

I did a work-a-round. It's not rocket science, but it works.

Sub GetValue()
Dim myRng As Range
Set myRng = Sheets(2).Range("A1")
If myRng.HasFormula Then
myVar = myRng.Formula
Else
myVar = myRng.Value
End If
myRng.Formula =
"='U:\ExcelFiles\ADI-JournalEntries\Current_Month\[Advance-O&M_Cur.xls]Journ
al1'!$R$22"
MsgBox Format(myRng, "###,###.#0")
myRng = myVar
End Sub

Thanks for your help.

Tommy

"Tom Ogilvy" wrote in message
...
Unless you wanted to open the file and get the value.

--
Regards,
Tom Ogilvy

"Tommy Flynn" wrote in message
...
Thanks. I'll take a look.

Tommy Flynn

"Tom Ogilvy" wrote in message
...
Excel VBA doesn't support linking to closed workbooks like excel

itself
does. John Walkenbach has documented a method that uses and Excel 4

macro
to in VBA to do this.

http://j-walk.com/ss/excel/tips/tip82.htm

you can possibly use ADO, but that would seem more appropriate for a

data
table.

http://www.erlandsendata.no/english/vba/adodao/

Andy Wiggins recently suggest sql.request

This might be a help for getting data to and from Excel and Access: It
includes examples of using variables in SQL queries.
http://www.bygsoftware.com/examples/sql.html

Or you can get there from the "Excel with Access Databases" section on

page:
http://www.bygsoftware.com/examples/examples.htm

It demonstrates how to use SQL in Excel's VBA to:

* create a database,
* create a table and add data to it,
* select data from a table,
* delete a table,
* delete a database.

You can also download the demonstration file called "excelsql.zip".

The code is open and commented.


--

Regards
Andy Wiggins
www.BygSoftware.com
===========================

--
Regards,
Tom Ogilvy


"Tommy Flynn" wrote in message
...
I'm almost there, but I just can't get it quit right. I am try to

get
a
value from a cell using the full path to the file. This ain't

working,
but
it's close. What am I doing wrong?

Sub Test()
pName =
"U:\ExcelFiles\ADI-JournalEntries\Current_Month\Advance-O&M_Cur.xls"
MsgBox pName & Sheets("Journal1").Range("R22")
End Sub












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
Full path-name in title bar ? Stefan Excel Discussion (Misc queries) 14 January 13th 10 12:00 PM
Insert Full Path Roxy Excel Worksheet Functions 4 May 4th 07 09:31 PM
Full path possible to be seen? Octavio New Users to Excel 10 July 2nd 06 08:51 PM
Full path in title bar ntoze Excel Discussion (Misc queries) 1 April 18th 06 04:18 PM
full UNC path in footer muttdaemon Excel Discussion (Misc queries) 1 October 12th 05 06:21 PM


All times are GMT +1. The time now is 11:30 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"