Linking to File from VB

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
There are many ways, depending on what you actually want to do and the type of file.

You could use a hyperlink.

You coud use Shell.

You could automate the application the file is associated with.
 
Upvote 0
Try using
Workbooks.Open Filename:= "Your Path and File name"

Assumed that you are trying to open an excel file.
 
Upvote 0
I want to open an excel file from another application. When I used

Workbooks.Open Filename:="H:\Desktop\Spreadsheets & Databases\Alaska.xls" it told me that it wasn't defined.
 
Upvote 0
What's the other application?
 
Upvote 0
Steven

It might help us to help you if we knew what the application is.:)

Does it support VBA?
 
Upvote 0
Reflections for Regis Graphics? IBM? Terminal Emulator? More details please.

Please invest some time into your post so we don't have to spend so much time asking you questions to try and figure out how to help you. If you simply want to open up a workbook and have no intention on further interaction with this workbook, use the Shell API function. I would not use this code from within Excel hosted VBA to open a workbook.

<table width="100%" border="1" bgcolor="White" style="filter:progid:DXImageTransform.Microsoft.Gradient(endColorstr='#C0CFE2', startColorstr='#FFFFFF', gradientType='0');"><tr><TD><font size="2" face=Courier New>  <font color="#0000A0">Private</font> <font color="#0000A0">Declare</font> <font color="#0000A0">Function</font> ShellExecute <font color="#0000A0">Lib</font> "shell32.dll" <font color="#0000A0">Alias</font> "ShellExecuteA" _
       (ByVal hwnd <font color="#0000A0">As</font> Long, <font color="#0000A0">ByVal</font> lpOperation <font color="#0000A0">As</font> String, <font color="#0000A0">ByVal</font> lpFile <font color="#0000A0">As</font> String, _
       <font color="#0000A0">ByVal</font> lpParameters <font color="#0000A0">As</font> String, <font color="#0000A0">ByVal</font> lpDirectory <font color="#0000A0">As</font> String, <font color="#0000A0">ByVal</font> nShowCmd <font color="#0000A0">As</font> Long) <font color="#0000A0">As</font> <font color="#0000A0">Long</font>

  <font color="#0000A0">Sub</font> Example()
       <font color="#0000A0">Dim</font> WbPath <font color="#0000A0">As</font> <font color="#0000A0">String</font>
       WbPath = "C:\Documents and Settings\Somebody\YouWorkbook.xls"
       <font color="#0000A0">Call</font> ShellExecute(0, "Open", WbPath, "", "", 1)
  <font color="#0000A0">End</font> <font color="#0000A0">Sub</font>
</FONT></td></tr></table><button onclick='document.all("927200623332781").value=document.all("927200623332781").value.replace(/<br \/>\s\s/g,"");document.all("927200623332781").value=document.all("927200623332781").value.replace(/<br \/>/g,"");window.clipboardData.setData("Text",document.all("927200623332781").value);'>Copy to Clipboard</BUTTON><textarea style="position:absolute;visibility:hidden" name="927200623332781" wrap="virtual">
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Sub Example()
Dim WbPath As String
WbPath = "C:\Documents and Settings\Somebody\YouWorkbook.xls"
Call ShellExecute(0, "Open", WbPath, "", "", 1)
End Sub</textarea>

If your overall purpose is to share data between your Reflection session and the workbook, you need to specify this.
 
Upvote 0

Forum statistics

Threads
1,214,516
Messages
6,119,981
Members
448,934
Latest member
audette89

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top