×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Data from same workbook issue

Data from same workbook issue

Data from same workbook issue

(OP)
Hi, how can i make this so it doesnt open another excel sheet but uses the one thats already open. For example, this macro is in workbook book1 and i want it to use the data in cell b3 from this same workbook to input data into Attachmate.

Thanks



CODE -->

Dim xlApp As Object, xlSheet As Object, MyRange As Object
        Set xlApp = CreateObject("excel.application")
        xlApp.Application.DisplayAlerts = False 'Turn off Warning Messages'
        xlApp.Visible = True
        xlApp.Workbooks.Open Filename:="c:\test.xlsx"
        Set xlSheet = xlApp.ActiveSheet
        Set MyRange = xlApp.ActiveSheet.Range("B3:B14") 

RE: Data from same workbook issue

GetObject()

RE: Data from same workbook issue

(OP)
Thanks SkipVought, so basically i remove createobject and use getobject()
why does it still open new excel sheet though? i just want to use the current one that already opened

RE: Data from same workbook issue

Sorry I did not read your post fully.

If you are coding in excel VBA, you do not need to create or get an Excel Aplication Object. It's in the application you're using! You would only need to create an Excel Application Object if you were coding in some OTHER application, like Attachmate!Extra, or MS Access.

So you have a macro in Book1? You really ought to SAVE this workbook before doing any more coding.

Will this workbook act as a master for opening other workbooks and scraping data from a terminal emulator, or just opening test.xlsx?

RE: Data from same workbook issue

So far you've started three threads in two Attachmate forums.

The first one you entered regarded screen navigation, which is a basic requirement before proceeding to other questions. Has this logic been addressed?

RE: Data from same workbook issue

(OP)
this is the master workbook and im not opening any other files

RE: Data from same workbook issue

So tell me what this macro in the master will do.

RE: Data from same workbook issue

(OP)
i have master excel sheet with customers account # in cell A1. When i click on a button it will go into mainframe with that account # and extra data and input it into the same excel sheet

RE: Data from same workbook issue

So why do you open text.xlsx?

RE: Data from same workbook issue

(OP)
i removed that and it still doesnt work

RE: Data from same workbook issue

WHAT still does not work? My crystal ball is "not working!"

RE: Data from same workbook issue

Quote:

When i click on a button it will go into mainframe

do you know if this button calls a script written in Excel VBA or does it call an Extra Macro to run?

if your script is in Excel VBA, there would be no need for the above code that you posted on 14 Apr 15 20:35

RE: Data from same workbook issue

(OP)
hi remy988, script is in Excel VBA. can you please explain

RE: Data from same workbook issue

Biznez, please answer Skip's question

CODE

WHAT still does not work? 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close