ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Open another excel file in macro (https://www.excelbanter.com/excel-programming/361952-open-another-excel-file-macro.html)

DKY[_116_]

Open another excel file in macro
 

I'm trying to open another excel file to no avail. Here's what I have:

Code:
--------------------
Dim Location As String
Location = "U:\BridgeRun_" & VendorCode & "_" & Months & "_Months.xls"
GetObject (Location)
--------------------

Any other ideas?


--
DKY
------------------------------------------------------------------------
DKY's Profile: http://www.excelforum.com/member.php...o&userid=14515
View this thread: http://www.excelforum.com/showthread...hreadid=543838


Chip Pearson

Open another excel file in macro
 
Use the Open method of the Workbooks object.

Workbooks.Open Filename:=your_file_name


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"DKY" wrote in
message ...

I'm trying to open another excel file to no avail. Here's what
I have:

Code:
--------------------
Dim Location As String
Location = "U:\BridgeRun_" & VendorCode & "_" & Months &
"_Months.xls"
GetObject (Location)
--------------------

Any other ideas?


--
DKY
------------------------------------------------------------------------
DKY's Profile:
http://www.excelforum.com/member.php...o&userid=14515
View this thread:
http://www.excelforum.com/showthread...hreadid=543838




Ken Hudson

Open another excel file in macro
 
Hi,
Looks to me like GetObject is not used for Excel files.
I think you should be using:

Workbooks.Open Filename:= Location

to open an Excel workbook.

--
Ken Hudson


"DKY" wrote:


I'm trying to open another excel file to no avail. Here's what I have:

Code:
--------------------
Dim Location As String
Location = "U:\BridgeRun_" & VendorCode & "_" & Months & "_Months.xls"
GetObject (Location)
--------------------

Any other ideas?


--
DKY
------------------------------------------------------------------------
DKY's Profile: http://www.excelforum.com/member.php...o&userid=14515
View this thread: http://www.excelforum.com/showthread...hreadid=543838




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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com