Add numbers to a Excel sheet From MS Word doc using VBA

Microsoft OFFICE


  • 1. code page in text files
    1) Did anybody know how to recognize a code page in text files? Can I use API function: GetConsoleOutputCP and SetConsoleOutputCP? I need to get some data from a text file (using DHNcode page) and write them to another file in the same format. Readed data are displayed in MSExcel form. 2) How to convert text between code pages?
  • 2. the answer was 257, but why !??
    hi I have used Office XP VBA to automated some of our company contract documents. one of the final steps to the process was making the documents print to the manual tray 1 of the given printers. the following snip of code was what I tried first <snip> 'create contract Set wdContract = Documents.Add(Template:="G:\contract\docs\", NewTemplate:=False, DocumentType:=0) 'force to print from manual feed tray wdContract.PageSetup.FirstPageTray = wdPrinterManualFeed wdContract.PageSetup.OtherPagesTray = wdPrinterManualFeed </snip> this was derived from the inline suggestion that the IDE makes ! but upon running the code, it seemed to ignore this instruction, but no errors were thrown up. I then created a new blank doc and used the macro recorder and obtained the following <snip> wdContract.PageSetup.FirstPageTray = 257 wdContract.PageSetup.OtherPagesTray = 257 </snip> this seems to work completely as expected ! I'm not looking a gift horse ....etc. etc. etc., but can anyone shed light as to a) why the first version fails b) where/what/why this 257 value comes from, and why it works ? also, one of the documents is an Excel document, the above method only works for word docs, can anyone point me in the direction of how to code for Tray 1 manual feed for Excel objects ?? thanks _scott
  • 3. Visual basic 6 probleme with dataenvironment
    to view data from a data base i created a data report linked with a data environement. The problem is that the instruction to assign a data report to a table is fixed exemple: to initialise the connection i used this code DataEnvironment1.connectTOF.Open Parambase.baseOF1.Text, , , -1 DataEnvironment1.rsNumOF.Open "[Table des OF]", DataEnvironment1.connectTOF, , , adCmdTable Set RapportOF.DataSource = DataEnvironment1 RapportOF.DataMember = "NumOF" RapportOF.Show where Parambase.baseOF1.Text is the path name for the database location, connectTOF is the connection with Microsoft Jet, NumOF is the CommandText for the Table RapportOF is the datareport whitch has been designed with an exemple table. instead of having a fixed table name, i would like to use a variable ( instead of Table des OF) but the instruction is not allow to do that. If somebody have an idea it would help a lot Thank you very much
  • 4. Reports and Hyperlinks in Access Runtime 2002
    Good Day I have a report in Access 2002 program that goes and gets the hyperlinks with in a form and past the photos into the report. I do this with the following code "On Page" and all works well. When I generate a runtime version and put it on a client computer the photos and hyperlinks will not show up. In other words the program does not work in Run Time. Any idea what DLL might be the problem. Here is the code I am using Dim hyp1 As String Dim hyp2 As String Dim hyp3 As String Dim hyp4 As String Dim hyp5 As String On Error Resume Next hyp1 = Photo.HyperLink.Address Image42.Picture = hyp1 On Error Resume Next hyp2 = Photo2.HyperLink.Address Image43.Picture = hyp2 On Error Resume Next hyp3 = Photo3.HyperLink.Address Image44.Picture = hyp3 On Error Resume Next hyp4 = Photo4.HyperLink.Address Image45.Picture = hyp4 On Error Resume Next hyp5 = Photo5.HyperLink.Address Image46.Picture = hyp5 . Thanks Wayne

Add numbers to a Excel sheet From MS Word doc using VBA

Postby herman » Sat, 12 Feb 2005 21:47:59 GMT

I have macros in my MS Word to assist in marking essay's by inserting
standard comments to the documents (with buttons in the menue bar).
I would like to have a graph automatically update as I run these
Therefore I need to either link to an excel sheet and insert numbers
into the Excel sheet by using "MS Word macro's", or i need to be able
to change an embedded sheet with macros in word.

Hope all that makes sense

Can someone please help

Re: Add numbers to a Excel sheet From MS Word doc using VBA

Postby Cindy M -WordMVP- » Sat, 19 Feb 2005 18:13:31 GMT

> I have macros in my MS Word to assist in marking essay's by inserting
Oh, it makes sense. And it can be done. You might start by looking at 
the "run Excel from Word" article at

Cindy Meister
INTER-Solutions, Switzerland
 http://www.**--****.com/ (last update Jun 8 2004)

This reply is posted in the Newsgroup; please post any follow question 
or reply in the newsgroup and not by e-mail :-)

Similar Threads:

1.Opening A word Doc using VbA Word doc opens but minimizes

I have the following code I use in an Excel 2003 form to open a word
doc 2003. It opens fine but minimizes automatically after it opens.

Any ideas????

Private Sub()
Dim appWord As New Word.Application
    Dim myDocument As Word.Document

    Set appWord = CreateObject("word.application")
    appWord.Application.Visible = True
    Set myDoc = appWord.Application.Documents.Open("C:wordfile.doc")

    Set myDocument = Nothing
    Set appWord = Nothing

End sub


2.How to detect MS Word or MS Access calls MS Excel using VBA

Hello all

Is it possible to detect which application call the MS Excel using VBA?

I want to put some conditions in the Workbook_Open() method.

IF MS Word call Then
Do Job 1
Do Job 2

Any methods for doing it?


3.using vba to copy from excel to embedded word doc

I am writing a macro which embeds a blank Word document 
into an Excel spreadsheet. After embedding the document 
(which works), I want to copy information from the Excel 
spreadsheet into the embedded Word document. Although I 
can manually copy and paste the information, I cannot 
figure out how to get the macro to do this. When I use 
record macro, it stops recording as soon as I enter the 
Word document. When I look directly at the code, I can't 
find a command that will do the pasting? Is there a way to 
do this? If so, what is the code for it? Thank you.

4.Open WORD doc from EXCEL using VBA

Working in Office 2003, I have information in an EXCEL file which I can 
mailmerge manually into a WORD doc. 
I would like to automate this process from a button in the EXCEL file to ask 
the user if he wants to view the mailmerged WORD doc. which then goes on to 
carry out the mailmerge and display the final result in WORD.
If I want to give the option to print out the WORD doc, does this have to be 
part of the EXCEL or the WORD macro?
Any help appreciated.

5.Printing MS Word Doc From MS Excel

I have a workbook in Excel where I want to be able to 
place a button that will print a letter that has been 
created in a seperate MS Word documnet.
I have tried recording a macro but nothing happened.

Is there a way to link the two together to enable 
this 'button' to produce the letter ??



6. How to copy and rename MS Excel sheet from MS Access VBA (MS Office 2000)

Return to Microsoft OFFICE


Who is online

Users browsing this forum: No registered users and 23 guest