Opening An File From A Cell Reference

Nov 12, 2008

I want to use a macro to open an existing file on my c drive where the reference to that file is contained in a cell.

E.g. In my sheet, the cell A1 contains the following text "C:Documents and SettingsTest". Therefore the file I want to open using a macro will be Test.xls.

However the file I wish to open (and therefore the reference text in cell A1) could change (and it could also change to be a word document) so it needs to be able to adapt when a new valid file (and document type) reference is entered into the cell.

Also, as an aside, when I want to change the file referred to in A1, the easiest way I've found is to find the file I want in windows explorer, go to properties and copy the file reference and then paste it into A1. However the reference (from the properties tab) seems to miss the ".xls" or ".doc" at the end (see above). Is this an issue? If yes, then I'm happy to manually type the .xls or .doc extension at the end.

Is there an easier way to do this?

View 10 Replies


ADVERTISEMENT

Opening A File Without Opening A Workbook

Apr 17, 2007

I have a need to open a file from my companies intranet. My current method was to open said file via the method that the recorder gave me. However, I would like ot be able to open a said file without having to start open another workbook.

This is the path:
[url]

So the command is this:
Workbooks.Open [url]

Links are not actual links

So what I need to know. Is how can I open this file without opening a workbook. I haven't been able to use the VB "Open Statement" to open a file and I don't believe that I've been successfull using the Filesystem object either.

View 9 Replies View Related

Opening Excel File From List Of File Names Located In Single Sheet?

May 31, 2013

loop and range function to apply in the below code through which I can avoid writing code for all the rows.

I am trying to open excel files located in single folder from files name (along with the path) in single worksheet (Column B and Row 1 to 500).

I have created follwing code which opens the file and then runs a macro in it.

a Sub Test()
Dim strFName As String
strFName = Sheet1.Range("B2").Value

[Code].....

View 4 Replies View Related

VBA Code For Opening File With Variable Version Number In File Name?

Jan 29, 2014

I have a file that I save with a new version number each time I make major changes. The file name currently is: "Telephony Equipment Inventory v26 (Summary).xlsm". The "26" is the variable number. give me the vba code to ensure I open the file with the highest version number?

View 6 Replies View Related

Cell Reference In Other File

May 6, 2009

Explanation of problem:

I have 2 files: data.xls and calculation.xls

In data.xls, I enter a value in cell A1

In calculation.xls, I go to cell B1 and enter a reference to cell A1 on file data.xls. The following formula is entered in cell B1 of calculation.xls: =[data.xls]Sheet1!$A$1

Ok so far so good. Now when I change the value in data.xls, the value is updated automatically in the calculation.xls cell. And this is done even if I first update the value in data.xls and then later open the calculation.xls file (it will ask me to update).

Now let's say I have calculation.xls closed and I am updating the data.xls file. I enter a new entry above cell A1 in data.xls. So now the contents of cell A1 are shifed down to cell A2.

When I re-open my calculation.xls file, it is still referencing cell A1 in data.xls. Is there any way for me to link it in a way so that calculation.xls would know that it now needs to reference cell A2 since that cell got shifted down?

If both files are open then it works fine. But the way this setup will work, I will not always have them both open.

Also, if I copy the contents of data.xls onto another sheet on calculation.xls and reference the cell in the same file, then of course it works. But I would like it to work the other way with the files separate.

View 9 Replies View Related

Reference From File And Cell

Jan 12, 2012

I have multiple files in one folder: first.xlsx, second.xlsx, third.xlsx etc

In each of them the first cell is calle fist_indicator, second_indicator etc

In a new document i have a column A with all the names: fist, second, third

In a hidden second column i have ="="&"["&ZS(-1)&".xlsx]Tabelle1!"&"Z1S1" which gives the value of =[first.xlsx]Tabelle1!Z1S1 , =[second.xlsx]Tabelle1!Z1S1

So now when i try in column c to just say = R1C2 it gives a #NAME? error

Summarized, i have a manually filled in column A and with it i want to make another column that shows the first cell of each document (so it uses the fist colum + the other directions to show the first cell)

if i just add =[first.xlsx]Tabelle1!Z1S1 it works, but i want to be able to make this first.xlsx be changed according to the entry in column A.

View 1 Replies View Related

Using Cell Value In File Reference Formula

Jul 29, 2009

I have the following (working) formula that pulls the largest value from an array in a closed workbook on a network share:

=LARGE('\pdfpcoclu2k302pd10fap2k01dist10AdminFISCAL SHAREDM806 ReportsFY 2008-2009Clarion countyJanuary 09[385-4009.xls]M-805'!$F$11:$G$41,1)

I want to be able to use a cell value within the open workbook to change the name of the referenced workbook (i.e. the 385-4009 portion of the formula) in the fromula

I have atempted to use the following:

=LARGE('\pdfpcoclu2k302pd10fap2k01dist10AdminFISCAL SHAREDM806 ReportsFY 2008-2009Clarion countyJanuary 09["'"p8"'.xls]M-805'!$F$11:$G$41,1)

but excel returns an error and highlights the following portion of the formula:

'\pdfpcoclu2k302pd10fap2k01dist10AdminFISCAL

View 2 Replies View Related

Vlookup On A Cell That Reference Another File

Jan 9, 2009

I'm using a spreadsheet to assimilate data from a number of different files. Now I need to vlookup on this compiled data, but the vlookup cannot find the value because it is not looking at the value of the data in the cell, but rather the formula. How do I get vlookup to search a column by the value displayed in that cell, rather than the reference to some other file?

View 9 Replies View Related

Saving A File Using Cell Reference

Nov 8, 2009

I'm trying to open a workbook using a macro, then saving the workbook that's just been opened using a cell value as the title.

This is what I have so far ... to open up the workbook and then run a macro from there .. this works fine

Sub Test1()
'
' Test1 Macro
' Macro recorded 08/11/2009 by Tracy
'
Workbooks.Open ThisWorkbook.Path & "/MultiFuel Expense.xls"

Application.Run "'MultiFuel Expense.xls'!TestSave"

End Sub
This macro is the one I'm struggling with. I need to save a copy of the workbook I just opened (currently named MultiFuel Expense) in the same directory using the cell contents of G2 as it's name with _expense on the end.

Sub TestSave()
'
' TestSave Macro
' Macro recorded 08/11/2009 by Tracy
'
ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "" & Range("G2") & "_expense"
End Sub

View 9 Replies View Related

Reference CSV File & Cell In Formula

Jan 16, 2008

Trying to reference cells in a closed workbook for the first time, and am having problems. The formula in my cell is: ='H:Trial BalanceTESTING[12-07-2007.csv]12-07-2007'!$P2

At first it wouldn't work, and I always had a #REF! in that cell, but when I opened the csv file the correct value showed in the cell that has the formula. Is it not possible to have it work without me having to open the csv file as well?

View 2 Replies View Related

Save File As Pdf Based On Cell Reference A4?

Mar 6, 2014

I want to save my file as a pdf based on cell reference A4.

This is what i have

[Code] ....

View 2 Replies View Related

Save A File Dependant On Cell Reference

May 21, 2007

i have a order form that is customer dependant. the cust name on the form is manually entered by the user within a msg box. i have specific cusotmer folders on a shared machines C drive where i would like to save these excel docs to.

i understand that the cust name must match the name of the file and there needs to be a way to save those that do not have specific folder matching what was entered as the customer name.

the overall goal is to have the file name saved as CustomerNameDeliveryDateInvoiceNumber.xls where CustName is from cell "M3", delivery date is "Q7" and InvoiceNumber is "Q1".

Sub OrderFormSave()

Dim strCustFileName As String

savefile = "\SrSharedDocsCSPSharedFILESCustomerOrderForms & strCustFileName & "

ActiveWorkbook.SaveCopyAs savefile

End Sub

View 9 Replies View Related

Formula Reference To WorkBook With File Name In Cell

Apr 9, 2008

I need to reference a cell to another cell in a different workbook (not opened), however the name of this workbook contains a variable in its name. Something like:

='C:[Week" & variable &".xls]R23'!$D$3

where variable is the number of the week. I have tried using a cell name instead of a variable: ='C:[Week=($B$3).xls]R23'!$D$3

and I get a dialog box to update values by selecting a file.

View 4 Replies View Related

Error Message On Opening A File "Too Many Different Cell Formats"

Apr 18, 2006

I can't open a file anymore. On opening an exclamation mark message appears telling me the file contains "Too many different cell formats". After clicking "Ok" Excel doesn't continue the opening proces. However I need the info in the file. how to retreive the info in the file?

View 2 Replies View Related

VBA Code To Save File With Date As Reference To A Cell

Jun 19, 2014

I'm trying to make a vba that would save the file with the end date that will reference to a certain cell that user selects it. Working Sheet is a name of a File, and Current Sheet is a name of the panel where user will select the date.

ActiveWorkbook.SaveAs Filename:= WorkingSheet("Control Sheet").Range("D3").Value & Format(Date, "yyyymm") & ".xlsm", FileFormat:=51

But here i seem to missing the location

And I tried this one:

ActiveWorkbook.SaveAs Filename:="X:Work2014WorkingSheet& Format(Date,"yyyymm"). & ".xlsm" _, FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False

but it keeps popping up as 'expected end of statement' for yyymm?

View 8 Replies View Related

Save File / Workbook As Cell Reference Filepath & Name

Feb 8, 2008

I'm trying to get Mac OS X Excel VBA to understand this code however the ChDir reference and the filepath seem to be causing problems. I would like to specify in the code where the file should be stored but I did try removing the filepath section altogether but to no avail.

Option Explicit
Sub SvMe()
'Saves filename as value of A1 plus the current date
Dim newFile As String, fName As String
' Don't use "/" in date, invalid syntax
fName = Range("A1").Value
'Change the date format to whatever you'd like, but make sure it's in quotes
newFile = fName & " " & Format$(Date, "mm-dd-yyyy")
' Change directory to suit your PC, including USER NAME
ChDir _
"C:Documents and Settings USER NAME Desktop"
ActiveWorkbook. SaveAs Filename:=newFile
End Sub

View 2 Replies View Related

Opening A File ...

Sep 18, 2008

I am trying to do something simple but not quite sure how to do it. I am using the GetImportFileName and then selecting information of one sheet from that file and copying to another workbook. I need to know how to then get back to the file I have opened to search the next sheet and so on. The problem I have is with this line.

Workbooks(FileName).Activate

Sub GetImportFileName()
Dim Finfo As String
Dim FilterIndex As Integer
Dim Title As String
Dim FileName As Variant

' Set up list of file filters
Finfo = "All Files (*.*),*.*"

' Display *.* by default
FilterIndex = 5

' Set the dialog box caption
Title = "Select a file to Import"

' Get the Filename
FileName = Application.GetOpenFilename(Finfo, FilterIndex, Title)

' Open the Filename
Workbooks.Open FileName

WPD
End Sub

View 9 Replies View Related

Opening PDF File

Mar 12, 2006

When I press the button , i would like to open PDF file. The path is "\ engineeringABC.pdf"

View 2 Replies View Related

Opening A Powerpoint File

Sep 22, 2008

I have some VBA code that allows the user to open a linked powerpoint presentation from an Excel workbook. It works well but it does not ask the the user to update links so if the Excel book has changed the powerpoint stays the same. I am very new to VBA so I tend to copy things that work but don't always know why! Anyone out there know how to get it to update links automatically or at least ask the user to do so? Here is the code:

View 2 Replies View Related

Opening File With Dated Name Each Day?

Oct 20, 2009

I would like to open a certain file everyday. However each day this file is created and named with the date, for example Production_FixYYYYMMDD.csv, in VBA how do I accomplish this? The alternative I could think of is to create a .bat file to copy that file over to a separate directory and rename it Production_Fix.csv and just use that, but if that batch file fails to run that would cause issues.

View 4 Replies View Related

File In XLSTART Not Opening

Dec 29, 2009

Any idea why a file in my XLSTART folder does not open when I start Excel?

I had a cell in a file (not one of the files in XLSTART folder) that was refered to by thousands of other cells. I clicked on Trace Dependents and Excel then spent the next 10 minutes trying to point to all the cells. I eventually gave up and used the Windows Task Manager to close Excel. Ever since then Excel doesn't open 1 of the 3 files I have in the XLSTART folder.

View 6 Replies View Related

Macro- Opening A File

Aug 19, 2008

I'm looking for a command for a macro, haven't been able to find it thus far. Is it possible to get excel to open a .txt for example, and copy its contents into excel at an activecell?

View 9 Replies View Related

Opening Large File

Feb 4, 2009

I have a 14.3 MB xlsb file that I am trying to open with no success as it just hangs. Anyone have any ideas on how to get the data out of there? I would like to be able to get the data to a pivot and copy the pivot to another file to try and reduce the load on one file. I tried to import to Access but was told I was using a file version before 2007, which is impossible since it is a xlsb file.

View 9 Replies View Related

Personal File Not Opening

Jun 6, 2006

I am having a problem that shouldn't be that hard to fix, but I can't seem to figure it out. I have a file in the xlstart folder, called "personal.xls" with macros in it. The security level is at low, it isn't on the disabled list, and it won't automatically open when excel opens. If I double click on it, it opens. It just won't open when excel is first started. Is there any way to correct this?

View 2 Replies View Related

Dropdown Range Changes When Re-opening File?

Mar 1, 2013

I have a list of expenses on a certain project. I allocate each line to a certain type of expense by using a dropdown list. When re-opening the file, the first few lines were good: dropdownOK.jpg

But after a few lines, the dropdown range changed, although it keeps the selection I made in the previous version: dropdown_wrong.jpg

I have seen that the data validation list changed to =$A$2:$A$17 instead of my separate list =Dropdown!$A$2:$A$17 but cannot understand why excel has made this twist. Each month I update this list, which means adding lines to the list, both inserting them at the bottom, as in between other lines. I can't see any pattern, because it kept the range of the first 6 lines, when the previous version already had 50 lines or so. It does not only happen to the inserted lines, for example.

View 1 Replies View Related

Determine If A File IS A Workbook Before Opening

Aug 6, 2009

Is there anyway I can test / inspect a file before attempting to open it to check that it is indeed an Excel workbook?

I don't want to do it by file extension as that can / will be changed, but rather wondered if there was anyway to examine the ACTUAL file?

I'm wondering if all Excel workbook files start with a particular section of data or anything?

View 5 Replies View Related

Change DisplayCommentIndicator Upon Opening File

Aug 6, 2009

I am trying to turn off DisplayCommentIndicator when anyone opens this one file. I started with this not sure why its not working.

Private Sub Workbook_WindowActivate()
Application.DisplayCommentIndicator = xlNoIndicator
End Sub

also after anyone closes the file turn the comment indicator back on.

View 2 Replies View Related

Opening Unicode CSV File Using Opentext

Jul 7, 2012

I have written code to export data from excel as a unicode .csv file - see [URL] .....

However I now want to open that file by vba, yet it does not format the data correctly. I have a field in the delimited data that is string (in my .csv file strings are surrounded by " to indicate strings). This string can contain a vbLf as part of the string ie. the string goes over a couple of lines in one cell.

Using vba I open the .csv file as follows:

Code:
Workbooks.OpenText filename:=singlefname, origin:=65001, DataType:=xlDelimited, textqualifier:=xlTextQualifierDoubleQuote, comma:=True

yet when the code opens the file the vbLf starts a new worksheet row messing up the layout of the .csv file. It should just indicate a new line in a cell.

How to open the file so the vbLf only creates new line in the cell does not start a new worksheet row?

View 8 Replies View Related

Opening A FILE Give An Alarm

Nov 29, 2006

I have a training list file i made in excel that I put what people are trained on, the date they were trained and automatically it adds 2 years to the next column for when they need training again.

What I would like to do is make a macro, that will pop up a box (upon opening the .xls file) that states any of the employee who are due to be retrained, as well as what items they need retraining on.

View 9 Replies View Related

Rename Worksheet With Opening The File

Dec 12, 2008

I have the following code, which I use to open up a .xls file generated from Crystal Reports:

Application.ScreenUpdating = False
Application.DisplayAlerts = False

Dim fexport1 As String ' variables for the exported file
Dim fexport2 As String
Dim wb1 As String 'variables to change between the opened workbooks
Dim wb2 As String
strTemp = "Please Choose The Exported File"
MsgBox strTemp
fexport1 = Application.GetOpenFilename("Excel Files (*.xls), *.xls)")
If InStr(fexport1, "False") = 0 Then
Workbooks.Open fexport1
wb1 = ActiveWorkbook.Name

Else
strTemp = "Operation Canceled"
End If

The problem is that Crystal Reports generates the file with an invalid worksheet name (it contains a backslash) and I do not have access to modify the Crystal Report. Althought the file can be automatically repaired by Excel when manually opened, the macro chokes and the "Application.DisplayAlerts = False" does not fix it. The only solution I can think of is renaming the worksheet without opening the file.

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved