RE: Is there a way to run a macro upon opening a document?
From: Mister T (MisterT_at_discussions.microsoft.com)
Date: 08/12/04
- Next message: Bob Phillips: "Re: Display Alerts"
- Previous message: Earl: "Display Alerts"
- In reply to: Beverly76: "RE: Is there a way to run a macro upon opening a document?"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 12 Aug 2004 11:15:02 -0700
I think it should work if you go to the VB editor, open the "ThisWorkbook"
window and paste the following in that window (not in a module):
Private Sub Workbook_Open()
the code you want to run upon opening the workbook
End Sub
In other words, the macro above will be THE macro, it's not in addition to
your existing macro.
As an example, try the following first:
Private Sub Workbook_Open()
Msgbox "Hello"
End Sub
Hopefully that one works...
"Beverly76" wrote:
> I'm not sure where to put this code to make it work. I tried Pasting it into
> the macro (before and after my command lines). And I tried pasting it just
> onto the VBA Editor. But when I opened the file, nothing happened.
>
>
>
> "Mister T" wrote:
>
> > Private Sub Workbook_Open()
> >
> > your code here
> >
> > End Sub
> >
> > "Beverly76" wrote:
> >
> > > I have a macro that I use to open a dbf file and saves it as and xls file
> > > because for some reason Access has trouble opening it as a dbf (just this one
> > > file-the others are o.k.) I would like the macro to run upon opening the
> > > Excel document file without any other prompting because then I could automate
> > > the action of opening the file through MS Access so that the user would not
> > > have to pay too much attention to the process.
> > >
> > > Any ideas?
> > >
> > >
> > > --
> > > Sincerely,
> > > Beverly76
- Next message: Bob Phillips: "Re: Display Alerts"
- Previous message: Earl: "Display Alerts"
- In reply to: Beverly76: "RE: Is there a way to run a macro upon opening a document?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|