Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.charting,microsoft.public.excel.programming,microsoft.public.office.developer.vba,microsoft.public.word.tables,microsoft.public.word.vba.general
|
|||
|
|||
Naming word tables or coding reference library with vba
Hi-
I am working remotely in word vba through excel vba. Basically I have programed in excel to create a new word document, add a button, and then add code to the word document for when the button in excel is clicked. The code I am adding to the word document needs to copy a table and paste it (right above the button). I figured out how to copy a table if you give it an index number, but with the other code I am running the number of tables always changes. Therefore hardcoding an index number is a bad idea. I will end up copying different tables each time and not the one I want. Is it possible to add a name or range to that table, so I can just copy the table name or range? If this is not possible, I wanted to know if its possible to code adding an excel reference library in word. If I have the word document button code remote access excel to get the named table range that way, I need to figure out how to code an excel reference library into the button code. I do not know how or if this is possible. Manually setting it is not an option. I really hope someone can help me! Thank you so much in advance. sarah |
#2
Posted to microsoft.public.excel.charting,microsoft.public.excel.programming,microsoft.public.office.developer.vba,microsoft.public.word.tables,microsoft.public.word.vba.general
|
|||
|
|||
Naming word tables or coding reference library with vba
Sarah take a look at my post from a similar question here at
http://groups.google.com/group/micro...&q=deano&hl=en Any chance you can just use print statement to write one record at a time as below: Sub records_txtfile() Dim ff As Integer ff = FreeFile() Open "C:\textfile.txt" For Output As ff For r = Firstrecord To Lastrecord ' generate your record here For c = FirstCol To lastcol Print #ff, Cells(r, c); Next c Print #ff, 'blank line Next r Close ff End Sub take care, deano hornbecky83 wrote: Hi- I am working remotely in word vba through excel vba. Basically I have programed in excel to create a new word document, add a button, and then add code to the word document for when the button in excel is clicked. The code I am adding to the word document needs to copy a table and paste it (right above the button). I figured out how to copy a table if you give it an index number, but with the other code I am running the number of tables always changes. Therefore hardcoding an index number is a bad idea. I will end up copying different tables each time and not the one I want. Is it possible to add a name or range to that table, so I can just copy the table name or range? If this is not possible, I wanted to know if its possible to code adding an excel reference library in word. If I have the word document button code remote access excel to get the named table range that way, I need to figure out how to code an excel reference library into the button code. I do not know how or if this is possible. Manually setting it is not an option. I really hope someone can help me! Thank you so much in advance. sarah |
#3
Posted to microsoft.public.excel.charting,microsoft.public.excel.programming,microsoft.public.office.developer.vba,microsoft.public.word.tables,microsoft.public.word.vba.general
|
|||
|
|||
Naming word tables or coding reference library with vba
Hi Sarah,
If you assign a bookmark to the table, you can always find the table again via the bookmark - provided you're careful about putting another table within the bookmark range and not moving/deleting the bookmark. Another way would be to put the table inside a text box. Being a shape object, a textbox can be named (best done when created). Again, you'd have to be careful about putting another table into the same textbox. Cheers -- macropod [MVP - Microsoft Word] "hornbecky83" wrote in message ups.com... | Hi- | | I am working remotely in word vba through excel vba. Basically I have | programed in excel to create a new word document, add a button, and | then add code to the word document for when the button in excel is | clicked. The code I am adding to the word document needs to copy a | table and paste it (right above the button). I figured out how to copy | a table if you give it an index number, but with the other code I am | running the number of tables always changes. Therefore hardcoding an | index number is a bad idea. I will end up copying different tables | each time and not the one I want. Is it possible to add a name or | range to that table, so I can just copy the table name or range? | | If this is not possible, I wanted to know if its possible to code | adding an excel reference library in word. If I have the word document | button code remote access excel to get the named table range that way, | I need to figure out how to code an excel reference library into the | button code. I do not know how or if this is possible. Manually | setting it is not an option. I really hope someone can help me! Thank | you so much in advance. | | sarah | |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Naming word tables or coding reference library with vba | Charts and Charting in Excel | |||
Word Library reference | Excel Programming | |||
Reference Library - Missing Library in a lower version. | Excel Programming | |||
adding reference to the Word-Library | Excel Programming |