Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data from same workbook issue

Status
Not open for further replies.

Biznez

Technical User
Apr 9, 2015
106
CA
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")
 
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
 
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?
 
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?
 
this is the master workbook and im not opening any other files
 
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
 
i removed that and it still doesnt work
 
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
 
hi remy988, script is in Excel VBA. can you please explain
 
Biznez, please answer Skip's question
Code:
WHAT still does not work?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top