L
Launchnet via OfficeKB.com
In Cell A5, I have c:\my documents\specialhandout.xls.
Column A's width is set at 1 or 12 pixels. It's not necessary
to see what is in it.
Cell B5 displays the users description of the Excel file to open
To the Right of Cell B5 is a button with an attached
Macro. (See Macro Below) The button top is blank.
HOW USER SELECTS AND OPENS FILE
User selects Cell B5 . . . or B6 . . . or B7 etc.
Next, the user clicks the Macro Button
The activecell is changed 1 cell to the left, which for the example is Col A
This is where the path and file name are that is to be opened.
Then, the Macro continues running.
NOW, MY PROBLEM
I don't want to use the path and file name as defined
in the below macro. I want the path & file name
to be picked up from the active cell A5 or any other cell in Col
A
that may be the active cell. The reason being, that in
Cell A6 I have a different path & file name to open and B7 is
also different and so forth down Column A
The button along side of B5 would run the same macro
as the button along side B6 and the same for B7 etc. or
I could use one long (vertical) button.
This allows the user to simply select the desired cell in Col B,
then the user clicks the Button just to the right of the selected
cell and this then opens the file of their choice in
a new instance of Excel.
EXISTING MACRO
Sub NewExcelWithWorkbook()
Dim oXL As Object
Dim oWB As Object
ActiveCell.Offset(0, -1).Activate
Set oXL = CreateObject("Excel.Application")
oXL.Visible = True
BELOW IS THE CURRENT WORKING CODE THAT OPENS THE A
SPECIFIC FILE ONLY. THE PROBLEM IS THAT WHEN I USE THIS CODE,
I HAVE TO HAVE A DIFFERENT MACRO FOR EACH FILE THE USER
WANTS TO OPEN.
Set oWB = oXL.Workbooks.Open("c:\my documents\specialhandout.xls.")
I WANT TO REPLACE PART OF THIS CODE.
PLEASE BEAR WITH ME, I DON'T KNOW HOW IT SHOULD READ. I AM
POSITIVE THE IDEA WILL WORK IF SOMEONE CAN HELP ME
WITH THE CODE.
EXAMPLE:
Set oWB = oXL.Workbooks.Open("GET THE PATH AND CODE
FROM THE CURRENT ACTIVE OR SELECTED CELL IN COLUMN A HERE")
THIS THEN OPENS THE FILE THE USER HAS SELECTED.
End Sub
Column A's width is set at 1 or 12 pixels. It's not necessary
to see what is in it.
Cell B5 displays the users description of the Excel file to open
To the Right of Cell B5 is a button with an attached
Macro. (See Macro Below) The button top is blank.
HOW USER SELECTS AND OPENS FILE
User selects Cell B5 . . . or B6 . . . or B7 etc.
Next, the user clicks the Macro Button
The activecell is changed 1 cell to the left, which for the example is Col A
This is where the path and file name are that is to be opened.
Then, the Macro continues running.
NOW, MY PROBLEM
I don't want to use the path and file name as defined
in the below macro. I want the path & file name
to be picked up from the active cell A5 or any other cell in Col
A
that may be the active cell. The reason being, that in
Cell A6 I have a different path & file name to open and B7 is
also different and so forth down Column A
The button along side of B5 would run the same macro
as the button along side B6 and the same for B7 etc. or
I could use one long (vertical) button.
This allows the user to simply select the desired cell in Col B,
then the user clicks the Button just to the right of the selected
cell and this then opens the file of their choice in
a new instance of Excel.
EXISTING MACRO
Sub NewExcelWithWorkbook()
Dim oXL As Object
Dim oWB As Object
ActiveCell.Offset(0, -1).Activate
Set oXL = CreateObject("Excel.Application")
oXL.Visible = True
BELOW IS THE CURRENT WORKING CODE THAT OPENS THE A
SPECIFIC FILE ONLY. THE PROBLEM IS THAT WHEN I USE THIS CODE,
I HAVE TO HAVE A DIFFERENT MACRO FOR EACH FILE THE USER
WANTS TO OPEN.
Set oWB = oXL.Workbooks.Open("c:\my documents\specialhandout.xls.")
I WANT TO REPLACE PART OF THIS CODE.
PLEASE BEAR WITH ME, I DON'T KNOW HOW IT SHOULD READ. I AM
POSITIVE THE IDEA WILL WORK IF SOMEONE CAN HELP ME
WITH THE CODE.
EXAMPLE:
Set oWB = oXL.Workbooks.Open("GET THE PATH AND CODE
FROM THE CURRENT ACTIVE OR SELECTED CELL IN COLUMN A HERE")
THIS THEN OPENS THE FILE THE USER HAS SELECTED.
End Sub