#1
|
|||
|
|||
can I run a macro when I open a specific doc ??
Hi there
I have a word doc of which I wanna run a macro automatically when it opens. I need it to open an object.. i inserted it to this doc file. Can this be done ?? |
#2
|
||||
|
||||
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
thanks alot but how to order it to open an object inserted in this word file ??
like this file.xlsx ?? |
#4
|
||||
|
||||
Referencing embedded OLE objects doesn't use filenames - it uses shape or inlineshape references, such as:
Code:
Dim objOLE As Word.OLEFormat Set objOLE = ActiveDocument.InlineShapes(1).OLEFormat objOLE.Activate
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
"you are about to activate an embedded object that may contain viruses or be otherwise harmful to your computer"
How can i hide this message or auto accept it on my pc ?? i'll open this file too much & add it to the startup folder .. this message will distribute me !! |
#6
|
|||
|
|||
-----------------------
Dim TaskID As Long TaskID = Shell ("file.xlsx", vbNormalFocus) ----------------------- i got this code but i cant edit it to open an contained object !! it always open a file from my hard disk !! |
#7
|
||||
|
||||
According to http://support.microsoft.com/kb/291912:
"This feature is designed into Microsoft Office to help protect you from malicious code."
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#8
|
|||
|
|||
ok tell me how to open 2 objects in the same time ??
when i open the word file automatically open 2 objects ?? ,, & Thank U very much ,, |
#9
|
||||
|
||||
AFAIK Word can only have one object opened at a time.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#10
|
|||
|
|||
Why when i use this code
------------------------------------ Dim objOLE As Word.OLEFormat Set objOLE = ActiveDocument.InlineShapes(1).OLEFormat objOLE.Activate ------------------------------------ Show me this message And if i choose "No" This error appears ?? please help me ,, |
#11
|
||||
|
||||
You get the error message because your code has no error handling.
Cross-posted at: http://www.vbaexpress.com/forum/showthread.php?t=43982 For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro to replace one specific heading style with another | ubns | Word VBA | 44 | 09-04-2012 08:17 PM |
Need VBA For Macro On How To Remove Specific Words | netchie | Word VBA | 6 | 08-28-2012 03:37 PM |
Using Hyperlink to open Word Document at Specific Header | rossi45 | Word | 2 | 05-04-2012 06:03 PM |
can I run a macro when I open a specific doc. | shreked | Word | 8 | 01-12-2012 03:36 AM |
Macro for highlighting specific number of words | icsjohn | Word VBA | 2 | 12-07-2011 06:44 PM |