Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-12-2016, 03:12 PM
npalmer610 npalmer610 is offline Execute VBA on File Import Windows 7 64bit Execute VBA on File Import Office 2010 64bit
Novice
Execute VBA on File Import
 
Join Date: Feb 2016
Posts: 5
npalmer610 is on a distinguished road
Default Execute VBA on File Import

Hi, fellow forumers. I have several macros that I wish to execute across a file on import. I know you can execute VBA on close, save, even open, but I'm struggling to find the correct syntax to invoke macros after I've imported text into my blank file using the Import Text command, not copying and pasting. Of course, the code below is very rudimentary and it could well be that this is not a possibility in Word, but i'm hoping it is. The doc event listed below (Document_FileImport) is, of course, fictional. If anyone at least knows what the event name is, that would help immensely. Thanks for your help in advance.



Code:
Private Sub Document_FileImport()

  Call Macro1 
  Call Macro2
  Call Macro3 
  Call Macro4
  Call Macro5

End Sub
Reply With Quote
  #2  
Old 04-12-2016, 06:01 PM
macropod's Avatar
macropod macropod is offline Execute VBA on File Import Windows 7 64bit Execute VBA on File Import Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Presumably you want something like:
Code:
Sub InsertFile()
With Dialogs(wdDialogInsertObject)
  .Tab = 1
  .DisplayIcon = False
  .Link = False
  If .Show = True Then
    Call Macro1
    Call Macro2
    Call Macro3
    Call Macro4
    Call Macro5
  End If
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Execute VBA on File Import How to execute .exe file after opening an Excel file? S3CRET Excel Programming 2 11-08-2015 12:33 AM
import outline into existing file eNGiNe PowerPoint 0 02-18-2015 05:56 AM
import .mht file data to powerpoint Rubini MJ PowerPoint 0 07-24-2013 10:24 PM
Execute VBA on File Import Import HTML into Word .doc file? Clueless in Seattle Word 1 07-31-2012 12:12 PM
Execute VBA on File Import OST file import duanne14 Outlook 3 03-13-2011 07:48 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:58 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft