VBA To Create Word File And Add A Custom Property To It
Apr 1, 2009
I have an Excel sheet with a long list of data. A short example is shown below:
Section | Title | Item
1 | INTRODUCTION | a
1.1 | title2 | b
1.2 | title3 | c
1.2.1 | title4 | d
1.2.2 | title5 | e
I made a VBA macro in Excel that runs through this list and creates a new Word file for each item. The filename of the document is based on the data in the Excel file (section and title). Now I would like to add a custom property to each of the newly created Word files, i.e. the value in the 'item' column. Does anyone of you know how I should do this? Or should it be better if I write a macro in Word that runs through the Excel data to create the word files? Here is the code I use to generate the word files:
View 2 Replies
ADVERTISEMENT
Jun 12, 2009
I'm looking to create a new file from data in my table. I don't want to even imagine having to do this manually again...I'm optimistic there is a solution. All the data needed to create the file is in the table, but i need it stacked and organized in a weird way. It's almost to hard to explain...so I color coded an attachement that basically says it all. It's pretty much the same thing repeated over and over except the last 2 lines. It's just a really messed up organization. In the real version I need the new file in a new workbook. I'm extremely grateful to anyone who can automate this thing
View 2 Replies
View Related
Sep 14, 2007
I tried to create a custom menu for a specific file. However, after creating the menu, I posted the file in Sharepoint. When a user download the file from the sharepoint site, the custom menu doesn't work because it is looking for the macro links from my computer. Another problem is that now the custom menu shows up in all other excel files that I open.
My questions are:
1. How do I do it so that the custom menu shows up only when this file is opened up.
2. How do I go about making the menu to look for the macros embeded in the file itself instead of looking for it in my file folder.
View 9 Replies
View Related
Jul 31, 2014
I have an excel database where I register cases. I have in it a button that creates a folder with and ID nr that is in column A (I create new ID nr in the next row, when I press the button it will create a folder with that ID nr and inserts a blank word document in it). We have a template that we copy to the folder (depending what type of case). The idea would be that once the template is filled in and ready to print, It would take the values from the ID nr and a reference number a few cells to the right. Is it possible to tell excel to open the word document in the folder and create a PDF version with the ID nr and reference number. (there are only 2 templates, so the macro would have to look for one of the two in the folder)
The name of the templates are: "Standard" and "Other".
I guess the best way to start maybe this would be that I select the cell with the ID nr and then press a macro button to have this done.
One thing that needs to be done, is to put a copy in the same folder and another in a second folder called "Binder" in my documents folder.
View 1 Replies
View Related
Apr 6, 2007
I`m building a macro for which I would like to save a parameter for the macro to read and set.
I would like this parameter to be saved (permanently) in something like a custom workbook property, i.e. Tarabo (=Yes/No).
How can I create/read/wright using vba code?
View 9 Replies
View Related
May 13, 2005
I'm trying to use the Date Time Picker control as a time picker and only want hours and minutes to show. Can this be done with its custom format property (Example)? The usual number formatting string doesn't seem to work.
View 6 Replies
View Related
Jan 21, 2007
Is there a property that contains the name of an XML file a user has imported into Excel? If not is there any way I can retrieve the name of the file?
View 4 Replies
View Related
Jun 5, 2006
I'm trying to display some result in my sheet and I don't go further of the MsgBOx use. see my vba code
Dim xslt As New MSXML2.XSLTemplate40
Dim xslDoc As New MSXML2.FreeThreadedDOMDocument40
Dim xmlDoc As New MSXML2.DOMDocument40
Dim xslProc As IXSLProcessor
Dim paramxml As MSXML2.DOMDocument40
xslDoc.async = False
xslDoc.Load "c:compara.xsl"
If (xslDoc.parseError.errorCode <> 0) Then
Dim myErr
Set myErr = xslDoc.parseError
MsgBox ("Ha um erro " & myErr.reason)
Else
Set xslt.stylesheet = xslDoc
xmlDoc.async = False
xmlDoc.Load "C:Instructional_program.xml".................
View 2 Replies
View Related
Jun 9, 2007
I have an excel file which is in windows explorer has its property set to hidden.
I have another excel file, with some Vba in it, which opens the hidden file, inserts some data into it, saves the file and closes it.
ActiveWorkbook.Save
ActiveWorkbook.Close
This all works, except that the hidden property is lost in the process.
Is there a way of saving the file, and keeping the hidden property? This is just so that users cant see the file and accidently open it.
View 3 Replies
View Related
Apr 19, 2007
I was reviewing the "Create Custom Menu Items in Excel VBA" code located at [url] and cannot figure out something. How do I add a menu dropdown that contains MORE than one submenu item? This is the code my question pertains to: ...
View 9 Replies
View Related
Jun 23, 2014
I need a code to sort worksheets in a huge workbook. Is this technically possible!?
The information containing the worksheet order is available in worksheet "Aux", column A contains the rank (1,2,3,...etc.), whereas column B contains the corresponding worksheet names.
View 2 Replies
View Related
Aug 25, 2013
I am trying to create a custom sort list by going to preferences/custom lists and typing 37 items into a new list in Excel. It will not take all of the items after I type them in. Is there a limit as to how many items can be in the list. It seems to only take 18-20 items out of the 37 and erases the rest.
View 9 Replies
View Related
May 7, 2009
I am trying to create a msgprompt but instead of using the default yes or no, I need 3 options, so if the user clicks the first option, it will check a certain box. It will look like this.
"What envelopes do we use?
Choice 1. Branded Choice 2. Unbranded Choice 3. Client Branded
View 9 Replies
View Related
May 13, 2009
I am trying to create custom sort list. It works below when I define range as A1:A79.
Sub SortWS2()
Dim SortOrder As Variant
Dim sheetsorder As Range
Dim Ndx As Long
Application. ScreenUpdating = False
With Worksheets("Sort Order").Range("A1:A79")
For Ndx = .Cells.Count To 1 Step -1
Worksheets(.Cells(Ndx).Value).Move before:=Worksheets(1)
Next Ndx
End With
Application.ScreenUpdating = True
End Sub
I have created a dynamic range called sheetsorder. If I revise my code it does not work.
Sub SortWS2()................
View 6 Replies
View Related
Feb 15, 2010
I have created an Addin from one I found on this site which creates a menu on the CommandBar. On this menu I can add my Macros. The Menu is initially supposed to perform a delete function then an add, just in case the menu already exists on the CommandBar. It is also supposed to Uninstall the menu when you de-select the Addin. At the moment it doesn't seem to be doing either, as I have now got 5 CommandBar menu's all the same and I can't delete them?
This also creates a problem of when I add another macro, the menu on the CommandBar doesn't update with the addition?
I have attached the .xla file for you to look at and see where I'm going wrong.
VBA Macros & Creating An Add-in For Them
View 5 Replies
View Related
Jun 28, 2013
I have a worksheet that uses the INDIRECT function as part of cell validation to generate a custom 'name' range, this name then references a bunch of sheets that contain the actual range where the values for the validation list are stored. For example: ValidationExample.xlsx
Name = Color
Values = Blue, Red, Green
Name = Shape
Values = Square, Circle, Triangle
So what this allows me to do is in the first cell, I can define two options such as Color and Shape. Once one of these is selected, the next cell will have a formula for the validation as "=INDIRECT(A1)" then I will define two named ranges called 'Color' and 'Shape'. This will then show me the list of items in the cell based on previous selection. An example of this is attached to this posting above.
When the formula is written into the validation, an error message is generated saying that the formula will generate an error. Even with this message, the method works effectively to provide a blank list if nothing in the first cell is selected, or a list dependent on the selection of the first cell.
In this case, what I want to do is generate a macro that will populate the validation for a cell when new records are added. This won't always copy down from previous cells because the way I add records is through use of a macro and I generally find using the format painter in vba to be a fairly sloppy way of getting formats from other cells. So I go through a series of validation additions to each cell in the worksheet to get this validation created (I have no written this into the workbook attached).
VB:
Dim i As Long
Dim lastRow As Long
Dim sht As worksheet
[Code] .....
As I read in previous posts, Formula1 cannot contain an actual formula, only names and lists of items. Since each of the cells will have a changing reference, thus the INDIRECT function would need to change to reflect this, The 'Secondary' name consists of the following:
"=INDIRECT(OFFSET(INDIRECT(ADDRESS(ROW(), COLUMN()), 0,-1)))"
Which of course does not work due to the error when using INDIRECT in the first place (though the Address() function appropriately finds the cell with the validation in it's appropriate address). I can think of other ways to do this, such as having validation lists change in with VBA on a SelectionChange or Change event, but that's a lot of code that is subject to change when the named ranges have changes to them (which is fairly frequent). Is there any way to get the .Validation.Add method to ignore errors in the name supplied to it.
For reference, my code is this:
VB:
Private Sub cmdRefreshValidation_Click()
'Re-enters validation parameters to all cells to allow selections
Dim i As Long
Dim lastRow As Long
Dim sht As Worksheet
[Code] .....
View 1 Replies
View Related
Jan 30, 2008
I am having trouble creating a custom data entry form in excel. What steps would I need to take..
Attached is a example of the data, the Headers are in bold, the highlighted columns are to be drop boxes.
View 11 Replies
View Related
Feb 19, 2010
how I can create a custom mask that will always put a / at the start of each cell in column C. So basically when I enter a number in, say 350, the mask will automatically put a / in front of it - /350 or even better /space350. The only issue is that the number will change in length a little, so not sure if this is a problem or not.
View 4 Replies
View Related
Jan 15, 2013
How would I create a shortcut to automatically copy the contents of cell H1 to cell K1, in other word I would like to hit a shortcut key and have the contents of that cell pasted 3 cells to the right on the same line. I have to do this over and over again down the worksheet. I am working on taxes and want to copy values over to the expenses column as I find them.
I would also like to know if it is possible while having cell D1 highlighted I could have a shortcut created that would copy the value three cells over in H1 to cell K1. That would be the fastest, but I don't know if it is possible?
View 2 Replies
View Related
Sep 22, 2013
I am creating a custom autonumber in excel. The autonumber will be based on the value of another cell's value. So for eg, in cell A1 will look at B1, if B1 has the number 1, A1 will take B1 and add the autonumber to it, eg a, b, c.
If within, b5 the number is 2. So if the number in the corresponding row in b changes, the autonumber must restart.
I've decided to go with a-z for the autonumber as i realized for .1, .2, .3 is limited to 9 values in the list bec. 1.10 may be read as 1.1
I've tried a few options such as creating a named range, however the problem is getting the autonumber to restart.
Below is what i want to achieve via excel formula:
Column F
Column F
1.a
1
[Code] .........
View 5 Replies
View Related
Nov 12, 2013
I want to add some Data Validation for a cell and want it to validate that the entered data is in the format (DD/MM/YYYY HH:MM)
I guess I need to use a custom validation formula, however cant figure it out
View 1 Replies
View Related
Mar 26, 2014
I've created a custom Function. I would like for there to be a Helper when a user is entering the Function arguments.
For example if I go into a cell and type in =VLOOKUP(
A popup with appear that shows...VLOOKUP(Lookup_Value,Table_Array,col_index_num,[range_lookup]).
Is it possible for me to build something like this in my Function?
View 4 Replies
View Related
Jan 19, 2007
I am needing to create a sequential serial number using a format yyyy-nnn, where yyyy is the current year and nnn is a sequential number (2007-001). I've tried using both a formula and custom formats but cannot get the cell contents to display as desired. I've used TODAY()&"-"&"001", which gives a valid result of 39100-001, but this not what I need. I've tried many other combinations in the custom option for formatting the cell.
View 5 Replies
View Related
Feb 12, 2013
I've written a ton of VB macros that do various things to a raw data sheet. I want now to create a custom menu (in the the menu ribbon bar at the top of the screen). I'd like this menu to be used to activate the various macros for whoever has my add-in.
I've found several examples on how to create an add-in, and creating custom menus, however they all for when someone opens a workbook with the code, and then they remove the custom menu when the workbook is closed. I would like my custom menu to stay on the users ribbon bar no matter what workbook they have open. The only time the custom menu should not appear is if the user removes the add-in.
View 6 Replies
View Related
Aug 2, 2013
I am trying to find expected proportion of code per country by looking at current values. I have a list of countries and associated classifications (0-5) with counts, similar to as follows:
Country
code
count
USA
1
65465
USA
2
54651
USA
3
65411
[code]...
I am interested in creating a pivot table with the average of each code as a proportion of each country. The final table would be expected proportion of codes. The pivot table for this set would look like this:
Row Labels
Average
1
5.4%
2
3.9%
3
4.7%
[code]...
Mean per code of the proportion of code per country
View 1 Replies
View Related
Mar 25, 2014
I have to create a word file that has about 300 pages containing stats for about 400 different statistical indicators. It has to be updated on a monthly basis
The file is populated using data from an excel spreadsheet.
Is it possible to put links to the spreadsheet in the word document so that the I can update the spreadsheet and have the word document automatically update itself?
View 1 Replies
View Related
May 22, 2014
Is there any way to create a Macro that is any cell in column D has the word Shop it would change the adjacent word in column E from Roof Time to Shop Time?
View 1 Replies
View Related
Apr 28, 2014
I have a template document, created in MS Word. I want to generate, from Excel, a new document as would happen when you open the template from windows explorer or whatever ie. Template1.doc as opposed to Template.xlt.
The best I've managed to achieve is the opening of the template.
View 6 Replies
View Related
Jul 28, 2014
I am trying to create an IF function that searches for the word "No." I have created a table with monthly payments and if the payment is >= 0, it returns the word Yes. If the payment is
View 3 Replies
View Related
Apr 6, 2008
I am tring to find the xlb file, but it does show in my laptop. I open and close the xl App, but still could not find it
View 3 Replies
View Related