|
-
Mar 24th, 2005, 08:16 AM
#1
Thread Starter
Lively Member
how to open a word document when running an excel macro
I'm using an Excel macro. and I want to run a word macro
i'm looking for a command like
call wordmacro
or
Application.Run "doc1.doc!texte"
but those one aren't working
thanks
-
Mar 24th, 2005, 09:12 AM
#2
Re: how to open a word document when running an excel macro
If you are coding properly, with lots of objects you should be able to reference word then copy the macro code into Excel and use the objects set up. You may need to declare some constants though or replace them in the code.
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Mar 24th, 2005, 11:59 AM
#3
Thread Starter
Lively Member
Re: how to open a word document when running an excel macro
???
didn't understand anything
-
Mar 24th, 2005, 01:39 PM
#4
Thread Starter
Lively Member
Re: how to open a word document when running an excel macro
you mean something like this
but it looks like something is not really ok this is very slow
VB Code:
Sub test()
Dim objExcel As Object
Set objExcel = CreateObject("word.Application")
' Make Excel visible'
objExcel.Visible = True
'Open template'
Dim wb As Object
Set wb = objExcel.documents.Open("F:\dummy.doc")
Set wb = objExcel.Application.Run("F:\dummy.doc!mes")
End Sub
-
Mar 25th, 2005, 11:40 PM
#5
Fanatic Member
Re: how to open a word document when running an excel macro
here are the command line options for Word:
Code:
Word Startup Command Line Switches (All Versions)
\winword.exe [/a] [/c] [/ltemplate name] [/n] [/m[macroname]]
[/t] [/w] [/x] [/regserver] [/unregserver] [filename] [filename]
Switch Meaning
Blank Starts a new Word window in an existing instance of Word.
/a Starts Word without a template (including startup addins) Word 6 only
Starts Word without a template (including startup addins) or options stored
inthe registry, Word 95, 97, & 2000. only
/c Starts Word and runs Netmeeting. Word 2000 only.
/l Load a specific addin Word 95, 97, & 2000 only
/n No new default document
/m Runs a macro [/mmacroname] or prevent autoexec from running [/m] Word
6, 95, 97, & 2000.
Run a macro [/mmacroname] Word 1 & 2 only
Cannot be used with the /t switch
/q [Added in Word 2000 SR1] (quiet start) will suppress the opening
splash screen.
/r shorthand for /regserver
/u shorthand for /unregserver
Both work in Word (but not in Excel), i.e. in Word 97 and 2000.
(MS lists /u as 'no effect' for Word 2000 though.)
/t Bases a new document on the specified document Word 95, 97, & 2000.
Starts the Tutorial Word 1 only
/w Without displaying Tip Of The Day Word 6 only
Starts a new instance of Word. Word 2000 only.
/x Starts a new instance of Word that only accepts one DDE conversation.
Used by the Windows shell for printing. Word 97 & 2000.
/regserver Registers Word in the registry. Word 95, 97, & 2000.
/unregserver Unregisters Word in the registry. Word 95, 97, & 2000.
Filename Opens a file
Filename Filename Opens multiple files Word 6, 95, 97, & 2000.
The office Startup Application is a small companion program with the
following command line switches. It also provides services for starting
Office Help and in 2000 performs a test to see if Auto Repair should run.
Word 97
\osa.exe [/b] [/f] [/n]
Word 2000
\osa9.exe [/b] [/f] [/l] [/n]
Switch Meaning
/b Initilises OLE and some fonts so OLE programs will start faster. It's
tuned for office programs and basically puts the OLE libraries into
the disk cache.
/f Displays the Open Office Document dialog box.
/l Checks to see if the Office Toolbar should be loaded at startup, and
if so start the Office Toolbar.
/n Displays the New Office Document dialog box.
Examples
C:\Program Files\Microsoft Office\Office\winword.exe Filename
C:\Program Files\Microsoft Office\Office\winword.exe Filename Filename
C:\Program Files\Microsoft Office\Office\winword.exe /a
C:\Program Files\Microsoft Office\Office\winword.exe /n
C:\Program Files\Microsoft Office\Office\winword.exe /m
C:\Program Files\Microsoft Office\Office\winword.exe Filename /mmacroname
C:\Program Files\Microsoft Office\Office\winword.exe /tDocumentPathAndName
C:\Program Files\Microsoft Office\Office\winword.exe /t
C:\Program Files\Microsoft Office\Office\winword.exe /lAddinPathAndName
C:\Program Files\Microsoft Office\Office\winword.exe Filename /w
You can "Shell" out with any of these -
with a little bit of ingenuity and cleverness, I'm sure you can come up with something of greatness !!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|