Convert Batches Of Doc Files To PDFs - Add A Filter To FileDialog
Nov 1, 2013
Set up a quick piece of code to convert batches of .doc files to .pdfs
Question 1 : What is the proper syntax to add a filter to the FileDialog to only allow for .doc and .docx files
Code:
Sub DocTOpdf()
Dim s As Variant
Dim Res As Integer
Dim oWord As Object
[Code] .....
Question 2: It would seem that randomly when running the code a Run-time error -21467259 (80004005) occurs at
Code:
oWord.ActiveDocument.ExportAsFixedFormat OutputFileName:= _
s & ".pdf", ExportFormat:=wdExportFormatPDF, _
OpenAfterExport:=False, OptimizeFor:=wdExportOptimizeForOnScreen, Range:= _
wdExportAllDocument, From:=1, To:=1, Item:=wdExportDocumentContent, _
IncludeDocProps:=True, KeepIRM:=True, CreateBookmarks:= _
wdExportCreateNoBookmarks, DocStructureTags:=True, BitmapMissingFonts:= _
True, UseISO19005_1:=False
View 2 Replies
ADVERTISEMENT
Aug 16, 2004
I have a number of csv files with 30,000 - 60,000 records.
I'm looking for some code which will split them into batches of 250 record batches.
Each file id named FY838A, FY838B, FY838C etc.
I need something which will open the file then copy the first row (Field names), open a new book and paste the headers.
Then cut the first 250 records, rows 2:251 and paste them into the new book.
I then need to save them as a *.csv
All are named BatchFY838A (then B, C, D for each one)
Here's the main bit I can't figure out:
I would like to create a destination folder for each file.
I already have a main folder:
say C:IncompInbox
but when each file is created I need to make a folder for it to sit in:
C:IncompInboxFY838AFY 1
C:IncompInboxFY838AFY 2
C:IncompInboxFY838AFY 3
C:IncompInboxFY838AFY 4
(I need to create the FY838@ folder then the destination ones after that)
Until there are no records left to batch. i.e. the code needs to stop when it's completed the list (each one has a different amount of records)
Additional. Along with this I have 3 Word.doc's which need to be placed in each of the above folders, can I do this at the same time)
The end result is to be 3 Word.doc's and a *.csv file in each folder, this is for a huge Mail Merge which is already coded, so each files content will be 4 documents with exactly the same names.
View 9 Replies
View Related
Apr 8, 2014
I is it possible to convert all comma separated text files in a single folder in to excel files. But the requirement is to have 2 sheets in each new file. first to be the full file - with all columns, and in the second sheet to keep only colum A B D G H K L M O P R S T V W from the first sheet. The second sheet name must be the same as the first one but without the first "wlist_" in the name.
One more thing. The third column in the second is called "COUL". there are short letters for colors in french
can they be converted with the sort in English like it goes:
NO = B
BA = W
RG = R
SO = P
JA = Y
BE = L
VE = GY
GR = G
VI = V
MA = BR
BJ = TA
OR = O
Here is a link to the both CSV and an example excel file with the end result. In this example i haven`t change the shorts for the colors. It takes me too much time with the find and replace function. And at the moment i`m really pushed from time.
[URL]
View 9 Replies
View Related
Sep 26, 2007
I have about 100 Excel files in one folder that need to be saved as text files. They can keep the same name, but simply need to be converted to text files. I'd like to use VBA for this and I can't find examples that do exactly that...or ones that my limited knowledge can handle.
Excel files exist in C:Source and ALL of them should be saved as text files in C:Destination. Maybe there is an easier way, but I thought for sure there was a routine I could use.
View 4 Replies
View Related
Dec 21, 2007
I would like to be able to execute a command line that will convert an Excel csv file to an Excel file that is TAB delimited. In other words, replace the comma delimiter with a TAB delimiter without having to open the file in Excel. I am an inexperienced Excel user
View 2 Replies
View Related
Aug 1, 2007
I want to use the selected file (using FileDialog Object) as an argument in the Import External Data wizard.
here's the code I got so far:
Sub SelectFile()
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
Dim SelectedFile As Variant
With fd
.AllowMultiSelect = False
If .Show = -1 Then
For Each SelectedFile In .SelectedItems
Next SelectedFile
View 9 Replies
View Related
Sep 14, 2009
I am using application.FileDialog to make the user select a file, when clicking a button. Now, I have tested, what happens, when I click on "Abort", instead of selecting a file and clicking "OK". An error message appears, because no file is selected.
So my question is: How do I state in my code, what is supposed to happen, when the User Clicks on "abort" (I want the whole Sub to be aborted in this case)
View 2 Replies
View Related
May 2, 2006
I can use a FileDialog to have a file selected. But I still need to check if it really exists before continuing. How to do?
(I know there is a function FileExists but do not know how to use it with FileDialog if this is the way to do it)
View 9 Replies
View Related
Apr 22, 2007
trying to make the ButtonName record the selected csv file to CEMFullLinK
Dim CEMLinkTotal$,CEMFullLinK$,CEMProject$, UploadFileName$
CemNotesName = ThisWorkbook. Name
UploadFileName = ThisWorkbook.Path
Application.ScreenUpdating = False
On Error Goto ErrorHandler
'CEMFullLinK = Application. GetOpenFilename("CEM Schedule csv files (*.csv), *.csv", , " CEM Schedule Search for .csv file to upload")
Application.FileDialog(msoFileDialogFilePicker).InitialFileName = UploadFileName
Application.FileDialog(msoFileDialogFilePicker).Filters.Add "CEM Schedule csv file ", "*.csv; *.csv; *.csv", 1
Application.FileDialog(msoFileDialogFilePicker).ButtonName = "Selected .csv"
Application.FileDialog(msoFileDialogFilePicker).Title = " CEM Schedule Search for .csv file to upload"
CEMFullLinK = Application.FileDialog(msoFileDialogFilePicker).Show
CEMLinkTotal = Len(CEMFullLinK)
How do you control the button "Selected .csv"
View 7 Replies
View Related
Oct 11, 2012
What I am trying to is to count the number of times a certain number or character appears (either on its own or in a batch of consecutive cells containing that number/character) in a column.An example might clarify things (for reasons of brevity I will write the columns in rows):
If a column looks like (each 1-digit numbers / characters being a consecutive cell) 0 0 X X 0 0 X and I am counting for X, then I should get 2. If my column is X X 0 X X 0 X 0 0, then I should get 3. If my column is 0 X X 0 0 X 0 then I should get 2. If my column is X X 0 X X 0 X then I should get 3. Is there a formula to perform that calculation?
View 1 Replies
View Related
Mar 12, 2013
What I am doing is setting up a product ratecard sheet to run with our CRM system in work.
Each product has 10 quantities, with 10 different prices, but each product must have the same product code running down in column A
I have thousands of products to put in to dont want to manually type each code in.
I am ok with Excel, but I can not program in VBA, so i am looking for a formula to use.
The code is ZTRA-00001, which will stay the same for 10 rows, then there will be a space of 1 row and the next code for the next 10 rows in the column would be ZTRA-00002 etc.
View 1 Replies
View Related
Apr 23, 2013
How Do You Convert PDF Files Into An Excel File?
View 1 Replies
View Related
Nov 20, 2013
I have a large number (couple of hundred) pdf's in a folder for electrical test certificates. The pdf's are in the format 54 Pike Drive.pdf etc. and have the date modified.
Ideally, as well as the address I would like the date modified as this is pretty close to the date of the certificate so will suffice.
Failing the date, just the addresses will do which need to go on separate rows in Excel.
I've tried copying and pasting the files but to no avail.
View 13 Replies
View Related
Apr 3, 2012
Use look up to check batches of data a return a value dependent of multiple ifs?
I have this formula from here
=LOOKUP(COUNTIF(C4:C7,""&0),{0,1,2,3},{19.9,29.9,39.9,49.9})
What I am trying to achieve is using the above can it check
C4:C7 Grouped and named "first"
C8:C10 Grouped and named "second"
C11:C13 Grouped and named "third"
If one from each group is selected it returns 1 value, if 2 of each are selected it returns a second value and if 3 of each are selected it returns a third value?
I thought by grouping them it may give me the desired results but all it does is change if I select more than one from any of the groups.
View 2 Replies
View Related
Dec 1, 2008
I Use the Quickbook 2009 for accounting. I need to convert CSV files over to QBO files. Any Software are not to Convert CSV files to QBO files.
It's Possible to Convert the CSV files to QBO Files via Excel.
View 6 Replies
View Related
Dec 3, 2009
I've just created a spreadsheet that we will be using as a project review form. In this spreadsheet I have multiple rows of merged cells, column D to N, for comments. I need these comment areas, merged rows, to autofit whatever is cut and pasted or typed into them.
The first problem is cutting and pasting from a pdf. All of the documents we received for the projects we bid are in pdf format. We often cut and paste from those documents into an older version of our review sheet that was built in Word. Trying to cut and paste the same information into Excel ends up in failure. Is there a way that this can be done without jumping through hoops?
The second problem I’m running into is when I cut and paste into a comment area I get the typical Excel error message that the information being pasted does not fit the area it is being pasted into. It there a workaround for this?
My third problem is autofitting the pasted information into the merged cells. I’ve seen some VBA and tried a couple but they don’t work automatically when the comments area is filled. How can I do this? I don’t know VBA. I'm using MS Office 2003
View 2 Replies
View Related
Jun 24, 2014
I'm working on a mac and have a macro that will go through all the sheets in my workbook and save them as PDFs to a specific location.
Sub CreatePDF()
For sh = 19 To Sheets.Count
Sheets(sh).ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"/Users/mikemahoney/Desktop/Publisher Payables/Statements/June 2014" & Sheets(sh).Name & "June 2014 Revenue Share Statement" & ".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
Next
End Sub
The part in bold is obviously where I am saving the PDFs but it is also being included in the naming of the file. Need replacing the red text in the naming of the file with the contents of cell B9? I would still like to save the PDF to "/Users/mikemahoney/Desktop/Publisher Payables/Statements/June 2014" I just don't want the file-path to be included in the name of the file.
Also, this code seems to run into errors if a sheet is hidden, hence starting at sheet 19. Any way to tweak this code to skip over hidden sheets?
View 1 Replies
View Related
Jan 27, 2010
I did find something related
http://www.tek-tips.com/viewthread.cfm?qid=1167426
, but as my knowledge in VB very limited I'm unable to make the neccessary modifications to fit my case.
the case:
the warehouse I'm working on is tracked by a big and messy excel file that includes details about various components.
the warehouse is virtually represented by folders that represent a drawer, each drawer includes 0-10 components's dateasheets in pdf file format.
I'm looking for a script that would hyperlink the specific pdf to each component to a certain column that includes the component's name.
there's another column in the excel that supplies in which drawer the component resides as you can see:
http://img251.imageshack.us/img251/7830/blablaf.jpg
You can also see how the drawers are represented virtually by folders with datesheets inside
components 20-29 all reside in drawer 20.
its worth noting that sometimes the whole drawer is empty and so both the column in excel and the folder will be aswell.
the script should(I assume) check the pdf's filename in the drawer( mostly the files's name look like in the screenshot), but sometimes the name is only the component's name,so if there is no drawer number before the component's name it would still know how to identify and hyperlink the pdf.
View 9 Replies
View Related
Apr 1, 2009
The FOB PRICE in sheet JAN09SEA is in any of three currencies, HKD EUR or USD.
The output on sheet CONSOLIDATE should only be USD.
Also, you can see that some countries send their freight in two or even three different currencies. This would need to be accounted for.
Additionally to the currency issue, I need to sort the output to RM or FG. For that, on sheet CONSOLIDATE, we have a button located in G1 to switch types.
E.G. if presses for FG, the formula should only check for the values where the row is marked with FG in column X.
The freight charge is always in HKD and needs to be converted to USD as well. Also it should be FREIGHT = FREIGHT CHARGE + SURCHARGE converted to USD.
This is quite a lot of information. I hope someone can think of a solution for the problems.
If you need more information.
View 9 Replies
View Related
Feb 24, 2009
I've been asked to change a massive batch of Excel 2007 files to 2003 format (to send to a client who doesn't have the newer version). Apart from going into these files (there's over 500 of 'em ), can anyone suggest a means of doing this? I know that Microsoft has a Migration Manager tool, but it appears this only converts the other way around.
View 2 Replies
View Related
Jul 17, 2014
Below code Works for TAB delimeter but if there is ' ,' in a row its not reading correct data.Basically I am trying to read multiple .txt files to .csv .
Sub txt2csv()
Dim Fname As String, ipath As String, retstring, fs, a, i As Long
With Application.FileDialog(msoFileDialogFolderPicker)
[Code]....
View 2 Replies
View Related
Jan 25, 2010
Can you please help me enhancing the macro that you created for consolidating multiple workbooks into one. The macro creates worksheets based on the server names, can we create individual csv files as well for individual worksheets of the consolidated workbook?
View 9 Replies
View Related
Oct 5, 2004
I need to convert thousands of files from .csv to .xls format. Filenames are numbers (1.csv ... 20000.csv). Filenames do not change.
Could just open, Save As, and Close.
Is there a simple way to run a macro once and convert everything? I don't know how to code the macro to open one file, convert, then close, then open the next...
View 9 Replies
View Related
Aug 24, 2006
I have a lot of .txt files that needed to be converted to .csv file format. Right now I am doing it manually using MS Excel i.e. File > Open. For each file, I need to specify the length of each fields one by one, so it is quite an effort for me.
Is there any way to automate this process using MS Excel or any other existing programs?
View 3 Replies
View Related
May 3, 2007
1. I need your help in converting all the worksheets in a workbook to CSV format. Is it possible to do that with a macro?
2. I have 20 workbooks, each with 12 worksheets. I need to combine the data in all the workbooks to create a database. As I will not be
able to do that in Excel (due to the row limit), I am thinking of using MS Access.
Therefore I am planning to convert these excel files into CSV files and then use the CSV files to create an MS Access database.
View 9 Replies
View Related
Jan 9, 2014
I have an Excel file with multiple sheets (over 100). I want to save them each as an individual PDF, with different (but similar format) names.
As an example, I want each PDF to be be called "Date Name" (i.e. "1-8-2014 Sarah", and next one will be "1-8-2014 Beth", etc.)
Is there a way to do this all at once, instead of my having to manually save each one? Is there a way for me to set it so that the title lists the date and then, for example, whatever is listed in A1 (which will be the name)?
One other question is that because I get this report from someone else who generates it, the way the file is formatted on my computer is that the print area is set at too small, so if I convert immediately to PDF, everything gets messed up. I have to manually make the print area bigger so that the PDF version encompasses everything on one page. Right now I've been manually adjusting the print area page by page - any way to do this all at once?
View 1 Replies
View Related
Feb 25, 2014
I have a workbook with 100 sheets and I want to quickly save each sheet as its own PDF file. I was able to find some instructions, but the code keeps giving me an error at the highlighted spot.
[Code] ......
View 3 Replies
View Related
Oct 11, 2011
Is there a way to convert all files in folder, in this case, xml in excel format to xls without open them?
I recorded the macro below, but this needs to "Open" and "SaveAs" the current file in folder and there are a few thousands of xml files in folder.
I was wondering if through some ADO or VBA code this can be done without open the files in order to save resources and get the work done faster?
Code:
Sub Convert_XML_to_XLS()
Workbooks.Open Filename:="C:MyPathInputFile.xml"
ActiveWorkbook.SaveAs Filename:="C:MyPathInputFile.xlsx" _
, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False '
End Sub
View 3 Replies
View Related
Mar 13, 2014
I am using this codes to extract csv in to my workbook, how to extract only the specific no. of rows from a csv instead of all the rows, I would like to extract only the last 5000 rows of data
Code:
Option Explicit
Sub ConvertCSVs()
Dim wkbDest As Workbook
Dim wksDest As Worksheet
Dim strPath As String
[Code] .........
View 9 Replies
View Related
Jan 31, 2014
I have the following macro that exports pdf's for every value in a validation list. Currently it's setup where I have included each value in the macro. This is fine with just a few values but I am about to add 900.
My question is, is there a way to write the macro so it exports a pdf for every value within a dropdown list until it hits a null value instead of what I have below so i don't have to repeat everything for every value in the list?
Here is what i currently have.
Sub Export_MarketSpecific()
'
' Export_MarketSpecific Macro
'
'
Sheets("Home Page").Select
Sheets("MOA-Page 1").Visible = True
Sheets("MOA-Page 1").Select
Sheets("MOA-Page 2").Visible = True
Sheets("MOA-Page 1").Select
Range("D2").Value = Range(Range("D2").Validation.Formula1)(2).Value
[Code] ..........
View 7 Replies
View Related