Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] Third Party Tools
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 2.00 average. Display Modes
  #1  
Old 08-05-2004, 01:38 AM
pyang pyang is online now
Registered User
 
Join Date: 12-23-2003
Posts: 33
Unhappy How to get value from a specific cell in Excel

Hi,

I would like to retrieve the value from a particular cell location in an Excel doc and put it in a macro.
How can i do that?

Pls advice. Thank you.

py
Reply With Quote
  #2  
Old 08-05-2004, 09:03 AM
kevina kevina is online now
Registered User
 
Join Date: 03-27-2003
Posts: 825
You can use script code to do this using the Excel COM interface. Search the internet for an example, they are plentiful. There are probably free components that you can leverage to assist in this as well.
Reply With Quote
  #3  
Old 08-05-2004, 09:05 PM
pyang pyang is online now
Registered User
 
Join Date: 12-23-2003
Posts: 33
I'm not very sure. About the COM interface.

I've tried the following it is not showing any value?
Pls advice. Thank you.
--------------------------------------------------------------------------------
Dim xlApp
Dim xlBook
Dim xlSheet

' set reference to Application object
Set xlApp = CreateObject("Excel.Application")

' set reference to Workbook object
Set xlBook = xlApp.Workbooks.Open("C:\test.xls")

' set the reference to Worksheet for Common
Set xlSheet = xlBook.WorkSheets(1)

xlSheet.Range(%SRC_ROW%:%SRC_COL%).Value = %SOURCE_LOC%
msgbox(%SOURCE_LOC%), VBOK, "Test"

' close Excel and destroy object variables
xlApp.Quit
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing

--------------------------------------------------------------------------------
Reply With Quote
  #4  
Old 08-09-2004, 10:33 PM
pyang pyang is online now
Registered User
 
Join Date: 12-23-2003
Posts: 33
Anybody can help me???
Reply With Quote
  #5  
Old 08-10-2004, 09:24 AM
kevina kevina is online now
Registered User
 
Join Date: 03-27-2003
Posts: 825
Dim xlApp
Dim xlBook
Dim xlSheet
Dim Value

' set reference to Application object
Set xlApp = CreateObject("Excel.Application")

' set reference to Workbook object
Set xlBook = xlApp.Workbooks.Open("C:\test.xls")

' set the reference to Worksheet for Common
Set xlSheet = xlBook.WorkSheets(1)

'Value = xlSheet.Range(vbld_AllMacros()("SRC_ROW").Value & ":" & vbld_AllMacros()("SRC_COL")).Value
Value = xlSheet.Range("1:1").Text
Application.Macros(vbldTemporary).Add "SOURCE_LOC", Value

msgbox vbld_AllMacros()("SOURCE_LOC").Value, VBOK, "Test"

' close Excel and destroy object variables
xlApp.Quit
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing
Reply With Quote
  #6  
Old 08-10-2004, 09:23 PM
pyang pyang is online now
Registered User
 
Join Date: 12-23-2003
Posts: 33
Hi kevina,

Thank you. But it is still not showing any value in the messagebox neither is the macro SOURCE_LOC!!!

Any idea?
Thank you.

py
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 09:27 PM.


Copyright © 1999-2023 Kinook Software, Inc.