Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Old January 15th 07, 09:14 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Nov 2006
Posts: 1,726
Default 3d range names/references

Where is the error?

What does vWorkbookPath hold?

What does sWorkheet hold?

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"alfaista" wrote in message
...
i hope this is the correct place to ask this question.

i am accessing an Excel workbook from Access. i need to be able to get
the
value of a cell that has a 3d type of name/reference, i.e.
Sheet1:Sheet2!$E$2
= MyName.
i need it named like this because i will need the value off one of those
two
worksheets, based on which one the user needs.

here is some of my code...
Dim xlApplication As Excel.Application
Dim xlWorkbook As Excel.Workbook
Dim xlWorksheet As Excel.Worksheet

Set xlApplication = CreateObject("Excel.Application")
Set xlWorkbook = GetObject(vWorkbookPath)

xlWorkbook.Worksheets(sWorkSheet).Activate

vAns = xlWorkbook.ActiveSheet.Range(sName)

well, it doesn't work. says Application defined or Object defined error.
is it possible to do what i am trying to do?
if not, does anyone have any other ideas? i would prefer to not have
MyName1, MyName2, etc....for all these identical cells on different
worksheets.

thanks in advance for any help!




  #2   Report Post  
Old January 15th 07, 10:27 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Nov 2006
Posts: 1,726
Default 3d range names/references

I wouldn't think you can get an object in a newly created instance of Excel,
there will be none.

You should open it, so instead of

Set xlWorkbook = GetObject(vWorkbookPath)

use

Set xlWorkbook = xlApplication.Workbooks.Open(vWorkbookPath)


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"alfaista" wrote in message
...
the error happens at this line:
vAns = xlWorkbook.ActiveSheet.Range(sName)

vWorkbookPath holds the entire location string of the file i need opened:
"C:\Documents and Settings\Heidi Rose\My Documents\ExcelFile.xls"

sWorksheet holds the string for the worksheet name chosen by the user:
"Sheet1"

thanks!



"Bob Phillips" wrote:

Where is the error?

What does vWorkbookPath hold?

What does sWorkheet hold?

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"alfaista" wrote in message
...
i hope this is the correct place to ask this question.

i am accessing an Excel workbook from Access. i need to be able to get
the
value of a cell that has a 3d type of name/reference, i.e.
Sheet1:Sheet2!$E$2
= MyName.
i need it named like this because i will need the value off one of
those
two
worksheets, based on which one the user needs.

here is some of my code...
Dim xlApplication As Excel.Application
Dim xlWorkbook As Excel.Workbook
Dim xlWorksheet As Excel.Worksheet

Set xlApplication = CreateObject("Excel.Application")
Set xlWorkbook = GetObject(vWorkbookPath)

xlWorkbook.Worksheets(sWorkSheet).Activate

vAns = xlWorkbook.ActiveSheet.Range(sName)

well, it doesn't work. says Application defined or Object defined
error.
is it possible to do what i am trying to do?
if not, does anyone have any other ideas? i would prefer to not have
MyName1, MyName2, etc....for all these identical cells on different
worksheets.

thanks in advance for any help!








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 convert range names (about 100) to cell references? Kunjumol Excel Discussion (Misc queries) 1 March 27th 09 02:31 AM
range names to cell references Chris Excel Worksheet Functions 3 October 23rd 07 06:56 PM
Range Names convert to Cell References AlanC Excel Discussion (Misc queries) 10 September 21st 07 12:24 AM
How to rename references from range names to cell references Abbas Excel Discussion (Misc queries) 1 May 24th 06 06:18 PM
Replace range names with cell references? KH Excel Worksheet Functions 2 August 2nd 05 01:09 AM


All times are GMT +1. The time now is 03:47 AM.

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

About Us

"It's about Microsoft Excel"

 

Copyright © 2017