Keep Sheet Names Unchanged After Saving Them As TXT Files

Mar 24, 2014

I want two sheets of my Excel workbook to be saved as txt file. The name of the file is compiled of a fixed part ("TrialList" or "BlockList") and two values from another sheet (subject and session number):

[Code] ........

Now, saving the text files with the desired file names works perfectly. However, Excel decides to change the names of the sheets that have been saved as text files accordingly. This is something I want to prevent from happening, since a second loop of actions will end because of the unexpected sheet names...

View 1 Replies


ADVERTISEMENT

List Files & Cell Values With Specific Sheet Names From ListBox

Dec 4, 2008

I have this script (below, Krishnakumar orignally provided this script).

I'm trying to edit it to add cell values from cells C16 and E16 along with the worksheet name it displays in listbox2. So lets say worksheet "rollover" is the sheet being displayed in the listbox2.

I would like for it to look something like this:

rollover TT:'data from cell C16' TA:'data from cell E16'

Public FilePath As String
Public dic As Object
Public oWB As String
Public oWS As String
Public aWS As Worksheet

Private Sub CommandButton1_Click()
Dim i As Long, wb As Workbook, n As Long
With Me.ListBox2
For i = 0 To .ListCount - 1
If .Selected(i) = True Then
oWS = .list(i)
Set wb = Workbooks.Open(FilePath & oWB, UpdateLinks:=0)
wb.Sheets(oWS).Activate
Exit For
End If
Next
End With
End Sub

View 7 Replies View Related

Saving Comma Separated .txt Files As .csv Files

Sep 15, 2009

I have a large number of .txt files that are comma separated files (but not saved with the .csv extension) that I need to convert to files with the .csv extension.

Is there an easy way to do this for all files in a given folder? Ideally, the files don't even need to be opened as they are are quite large in size (70MB+) and there are a lot of them (500+).

View 9 Replies View Related

VBA Saving PDF Files Into Folders

Sep 29, 2013

I have this code that generates excel pages as pdf files, but I can't get it to save it in its individual folders. For example, I have the sheet name as Brian Lin, I want to save the pdf into the folder called Brian Lin, then if I have the sheet name as Lilly Tran, the pdf should save into the folder called Lilly Tran. Here's my code. The code is one step short of what I want it to do, it saves in the folder right before the name folders.

Code:

Sub Macro1()
Dim wsh As Worksheet, vWshs
Dim sFolderName As String, set_Path As String, name As String, hwas As String, sname As String, swsname As String
vWshs = Array("Rates", "Inputs")
set_Path = "C:UsersJonathanDesktopFaFundInvoices" & hwas & ""

[Code]...

View 4 Replies View Related

Close Workbooks (with Variable Names) Without Saving

Mar 7, 2014

I have completed a long macro, and at the end of the macro I want to close a few workbooks automatically without saving. These workbooks have been assigned variable names.

Is there a command line I can use, that will not prompt the user to save?

Variables:
MARM_fileNM
MARC_fileNM
MAKT_fileNM
Temp_fileNM

View 3 Replies View Related

Saving Causes Backup Files To Form?

Apr 19, 2013

Whenever I make a change to any of my spreadsheets and click save, a backup is created in the same folder. A sample document is attached. Download it, make a change, then save it.

View 3 Replies View Related

Excel 2010 :: Saving To TXT Files?

Nov 23, 2011

I'm saving information from excel 2010 in to a text file (txt), when doing this and opening up the txt file the below line is saving it with " at the start and at the end of the line.

:32A:110809GBP4,00

Is there any way when saving as a text file without the " pulling through at the start and at the end of the line?

View 2 Replies View Related

Saving Batch Files From Excel

Nov 22, 2013

I currently have 3 batch files that I would like to be able to update using VBA instead of manually adding the information to each one. My goal is to be able to use my excel file and when I add new lines I could then run the script to save and/or update each of the batch files. I would like to be able to add the new lines I added in excel to the end of the batch files. I use the batch files for automation purposes but I do not like the fact that I have to open each one and added the same lines three times. This is why I want to be able to update my excel file and then add those new lines to the batch file. An example of how to accomplish this task using VBA would be awesome.

View 2 Replies View Related

Copying Tabs And Saving Them As Files

Jun 13, 2007

I've already done a search and found this on ozgrid.com:

RunCodeOnAllXLSFiles

I'm sure it is what I need, but as a non-programmer, I'm having trouble using it.

I have 12 files, each with 14 tabs. Example:

File: Sector.xls
Tab 1: Region 1
Tab 2: Region 2
Tab 3: Region 3

The client now wants 14 files, each with 12 tabs:

File: Region 1.xls
Tab 1: Sector 1
Tab 2: Sector 2
Tab 3: Sector 3

My first attempt was to try a macro:

1) left click on tab
2) move or copy...
3) move selected sheets to book (File: Region 1.xls)
4) then go on to next tab...............

Now, this does loop through the requested files, I can see them open, then close. I'm guessing they are copying, but I take it that I need to have it paste, then go to the next? (The c:files is just generic, as the files are on our LAN, and I'm just paranoid. The "Erie St. Clair" are the actual names of the file, and the tabs).

View 2 Replies View Related

Saving Attached Files From Outlook To Folder

Mar 3, 2013

I'm programing a VBA macro in Outlook 2007. I have added a button to the quick bar so when i open an email and push that button, a Excel file opens and i can input some data. Thing is, i need that if the opened email have some kind of attachment, when i push the button i want this attachement to be saved into a specific folder. Is that posssible?

View 2 Replies View Related

Difference In File Size When Saving Excel Files?

Apr 11, 2013

I tried to use prtScrn button on the keyboard to capture the screen (excel UI) and then pasted it to excel then saved it. I tried to do the same thing on my friends machine and what surprises me is that the file size of two excel is different.

We use the same OS, excel version and the same machine specs.My saved excel file is around 7.91 mb in size while his is just around 235kb. Why is this like this?

Both pasted image have bmp as a format (default for excel when a you use print screen and directly paste it on excel.).

View 3 Replies View Related

Saving Macros As Global Addins Or Personal.xls Files

Jan 12, 2010

So i have a macro that i wrote that willclean up these datafeeds that i get. i want to be able to use them for each spreadsheet. So the first bit i tried was saving a personal.xls file in the xlstart folder in XP (MSE 2003) . That would automatically pull up but when i tried to run the macro on other worksheets i get the generic 400 error.

the next thing i tried was copying the macro to a module and adding function tags and taking out the sub tags. i then "saved" that in the addins folder then tried assiging my custom button to is through the macros prompt. When i gave the title box the absolute path to the addins folder with clean.xla cited it said it was invalid, so i tried saving it just as clean.xla expecting it to locate the file there anyway.

this far each time i try to run the macro globally it says it cant find the current sheetname!macroname So i must be missing a step somewhere... can anyone give advice, i have searched the forum and couldnt find a similar problem for solutions.

View 6 Replies View Related

User To Select Variable Folder For Saving Files

Jun 11, 2009

I would like my macro to prompt the user to select a folder for files to be either opened from or saved to during the running of my macro.

In fact, I need them to select two folders, one for this month and the other for last month.

I think I need to set the two folders as a variable but being fairly new to vba I'm not quite sure how to do this.

View 9 Replies View Related

Excel 2003 :: Saving Files Generated By External Application

Jul 23, 2013

I have the following code which edits an excel file and saves it in a different format, I think want the code to take this newly saved file and open it in an external application (Softplot) and then save it through this new application.

VB:
Sub FormatMacro1a(ws As Worksheet)
ws.Copy
Rows(1).Delete
Columns("D:E").Cut Destination:=Columns("J:K")
Columns("F:K").Cut Destination:=Columns("D:I")
Range("E1:E201").Value = "0"

[Code] .....

As it stands I have the file saving in a new format and I can open a specific file in softplot through VBA however where I am getting stuck is opening my newly saved file and then saving it.

I have tried the following :

VB:
Path = "C:Program FilesSoftPlot-8softplot.exe"
File = "ActiveWorkbook"

View 3 Replies View Related

Saving Portions Of Selected Cell Data As New Text Files

Jun 21, 2009

I have a worksheet in my workbook that contains data for 25 different airfoils, each one in a cell space of 3 columns and 50 rows.
In order to do some analysis on these airfoils, I need to save each 3x50 as separate text file to define input for analysis code.
How can I do this in VB in one macro?

View 9 Replies View Related

Saving Sheets As Text Files Results In Blank Lines

May 11, 2008

I load an text file into an excel sheet and after some eventually changes I save (overwrite) it back into the text file again. Now the text file has become a file with 50 pages (49 empty pages). How can I avoid this or how can I set an EOF when no more written lines follows. The code for saving the excel sheet is this:

Application. ScreenUpdating = False
Application.DisplayAlerts = False
Sheets(wsImport).Select
Sheets(wsImport).copy
ActiveWorkbook.SaveAs FileName:=WorkFolder & WorkFile, _
FileFormat:=xlText, CreateBackup:=False
ActiveWorkbook.Close
'ThisWorkbook.Activate
Sheets(wsKwartaal).Activate

View 6 Replies View Related

Can Create Data Validation List Of Names Created In Name Box Or Sheet Tab Names

May 7, 2012

Can I create data validation list of the names created in the name box or of the sheet tab names?

View 5 Replies View Related

Excel 2010 :: VBA - Hide Sheets Using Code Names Not Sheet Names

Oct 15, 2013

Code:

Sheets(Array("Sheet 1", "Sheet 2")).Visible = False

How do I convert the above to using Sheet Codes Names, Sheet1 and Sheet2?

Want to ensure my code will work if the user changes the sheet name.

View 2 Replies View Related

Create Array Of File Names/sheet Names

May 1, 2008

Two part question:

1) I'm relatively new to arrays, but what I need to do is generate a list of file names and the sheets within each one. I would like to use an array for this, but since I don't have much experience.... well....that's why I'm here. Can someone point me in the right direction?

2) And the second part of this.... I was planning on using the FileSystemObject to determine the files in a selected folder and loop through that list of files, opening each one and harvesting the required info (file name and all sheet names). Should I use the FSO or is there something built into Excel that might be better (and also limit the number of dependencies for this little "project" of mine).

View 9 Replies View Related

List Sheet Names And Internal Names Within Workbook

Feb 25, 2011

Is it possible to produce a list on a new worksheet of all sheet names and their their internal names within a workbook?

If so I would like the tabbed name's to begin in say A2 with the corresponding internal name in B2.

View 3 Replies View Related

Re-Names Files In Folder

Feb 18, 2010

I have the below macro which had previously worked for me, but now I am getting a runtime error. I tried troubleshooting this on my own now, but am coming up with nothing.

Sub ReName_Files()
Dim rFiles As Range, rCell As Range
Dim StrNewName As String, strOld As String
Dim strPath As String
Dim wbOpen As Workbook

Application.ScreenUpdating = False

Set rFiles = Range("A1", Range("A65536").End(xlUp))
strPath = "E:FinanceUtilization Reports2008Month End"

For Each rCell In rFiles
strOld = strPath & rCell
StrNewName = rCell(1, 2)
Set wbOpen = Workbooks.Open(strOld)
wbOpen.SaveAs strPath & StrNewName
wbOpen.Close
Next rCell
Application.ScreenUpdating = True
End Sub

View 9 Replies View Related

Renaming Worksheets While Leaving Some Unchanged

Dec 18, 2012

I have a workbook with 70 worksheets and I'd like to rename 65 of them while leaving the first 5 worksheets unchanged.

The following changes all worksheets. Is there anyway to modify so that the name on the first 5 worksheets remain unchanged.

Sub ChangeWorkSheetName()
Dim WS As Worksheet
i = 1
On Error Resume Next
For Each WS In Worksheets
WS.Name = "Cost" & i
i = i + 1
Next
End Sub

View 6 Replies View Related

Copy Formula With Unchanged References

May 13, 2009

For example things like "=1+A1" or "=A1*B1"

Right now it changes the cells even with Paste Special!

View 8 Replies View Related

Track Changes Then Delete Unchanged Rows

Jul 10, 2008

I have a spreadsheet which is sent to one of my suppliers..they fill in there product information then send it back. When they need to add new products or make changes to existing ones they simply use the same file and re-send it. So I end up with two files, old and new. I need to flag up which cells have been changed in the new file compared with the old one.

At the moment I am copy and pasting the data from the new file into another spreadsheet which has =IF(B10='\HalusersSimon[Copy of Copy of Copy of Book1.xls]enter data'!$K$6,"","Change") in a empty column next to each column from the new file. This displays 'Change' in the cell next to the one I have pasted if it is different from the original file. Unfortunately I am still left with all of the rows where none of the data has changed, so I still have to sort through maybe 10000 rows....BORINGGGGG.

First of all the formula isnt perfect for the job...is there a macro which can do this instead...and secondly is there a macro to delete all rows within a certain area (so that I can keep the field headings and stuff) which dont contain the word 'Change' in them

View 10 Replies View Related

Copy Range With Formula Unchanged

Oct 3, 2008

I've been searching internet for quite a long time without luck, hope somebody can shed some light here.

I have two workbooks, let's say A and B, I need to copy a range R1 in Sheet1 of workbook A to Sheet1 of workbook B. The code I use like this:

View 6 Replies View Related

2000 Files All Saved As Different Names

Jan 24, 2009

I have 2000 excel files all saved as different names.

The Names of the the files are all from greyhound racing results, here are some examples.

4th January 2008 7.30
4th January 2008 7.45

So we have the date of the race and the time of the race.

In these 2000 files there is certian information I want to retrieve into 1 excel sheet to run analisis on them.

So cell A1 in every file is always the same and may contain a number I need.There are several numbers I want to retrieve from each file but I want it to display in 1 sheet, now I can do this manually and may have to but lets see.

View 9 Replies View Related

Kill Files With Specific Names

Mar 9, 2007

I have a directory that contain a large number of files. How do i preserve certain files with specific filenames while other files are deleted?

For example,
I have files that are named : "58-26150B", "58-26200", "58-26200B", "58-26500B", "58-26550" etc. Please refer to uploaded screenshot.

The files that i want to keep from the above are "58-26200", "58-26200B". The code should be able to loop through the entire directory & preserve only specific files while deleting the rest.

Private Sub CommandButton18_Click()

Dim nWave As Integer, i As Integer
Dim ConvergedFile As String, Pattern As String, KillFilePath As String, SimilarFile As String

nWave = Worksheets("nomogram").Cells(13, 4)
For i = 1 To nWave
ConvergedFile = CStr(Worksheets("nomogram").Cells(33, 3 + i)) 'Loop through list of wanted file names "58-26150", "60-25950" etc
Pattern = Mid(Trim(ConvergedFile), 1, 3) 'Update the filename prefixes i.e. "58-", "60-" etc

View 6 Replies View Related

Preventing A Function Being Called If Argument Is Unchanged

Jun 27, 2006

I have a function in a cell triggered on the value returned by a DDE link in another cell.

e.g. cell A1 contains =function1(A2) and cell A2 contains
=ADVFN|NYSE_CAT!CUR

function1 is triggered each time the DDE link updates regardless of whether the result returned has changed or not. How do I prevent function1 being triggered if the returned value has not changed?

View 9 Replies View Related

List Names Of Workbook Files In Folder

Apr 29, 2008

I tried to write some VBA code to loop through all the files in a folder and return the name of the file. (In my current example, all the files are excel workbooks)

Here is the code I have used:

Sub Load_List()

Dim lCount As Long
Dim wbResults As Workbook
Dim wbCodeBook As Workbook

Set wbCodeBook = ThisWorkbook

With Application.FileSearch
.NewSearch
'Change path to suit
.LookIn = "G:CFOMiddle OfficeDannyFine Tunning for JP"
.FileType = msoFileTypeExcelWorkbooks

However, when I tried to run the code, it give me the error message saying: the defined type of the variable are not been defined. Seems to me, that VBA dont have the variable type as Folder, or File.

View 7 Replies View Related

Loop Through Multiple Files To Create List Of Tab Names

Jul 26, 2013

I have a folder with 20 Excel files. I'm trying to create a master list of all the tab names. I can see all of the files opening, but it only copies some of the names.

VB:

Sub GetTabNames()
Dim wkBook1, wkBook2 As Workbook
Dim stFilePath1 As String
Dim FileList(1 To 18) As String
Dim iLoopSheet, iLoopProg As Integer
Application.ScreenUpdating = False

[Code] .....

View 2 Replies View Related







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