Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Running A MS Access Macro From MS Outlook


I've got a script in Outlook which exports all Outlook 2000 contacts to MS Access 2000 - but it appends it to the end of the table - I wish to empty the table before writing to it.

I have a macro in MS Access 2000 which clears the relevant table - but I am wondering if there is a way of running an access macro using outlook?

Either that or performing a SQL command in Outlook would be cool too.

Thanks.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Can You Get An Access Macro To Include Running An XL Macro
Is it possible to have an MS access run its own "thing" and in the middle of it all call on excel to run it owns macro?

Running An Access Macro
Hello,
I have a project which is now connected to an access database using DAO. I can add, edit and delete data from tables, but I need to run some access queries from the visual basic project, but as there are several of these I have grouped them into one access macro, i would like to know how I can run this macro from the visual basic project?
Any help will be welcome,
Thanks,
JDRas

Running An Access Macro
Hi

I have an application that runs on SQL Server. The Data Reporting tool in VB being rather limted does not allow me to create reports exactly as I would like so I have linked the tables in Microsoft Access and created Queries and Reports and macros to run the reports. The thing is (and its a big thing!!) I don't know how to code in VB to run the macro and supply the parameter for the report. I think it has something like / x main/

If anyone can help I would be very grateful

Thanks

Running An Access Macro From Excel
I have a macro set up in Access which merges various excel spreadsheets . What I want to do is include the right VB code in my excel macro so that once it has finished with the spreadsheet it automatically opens access and runs the macro in there....can this be done ??

Running A Access 2000 Macro From VB
Is there anyway to run a macro that has been setup inside of a already loaded database? thanks!

Running An Access Macro In Excel
I'm trying to run an Access Macro (Macro1) using the Visual Basic Editor in Excel. The code i'm using is:


Code:
Sub RunAccMacro()
Dim oAccess As Object, oDB As Object
Set oAccess = CreateObject("Access.Application")
oAccess.Visible = True
oAccess.OpenCurrentDatabase "J:UPSUPS.mdb"
oAccess.Run "Macro1"
End Sub

This opens the Access Database ok but then I get the runtime error:

Run-time error '2517':
Microsoft Access can't find the procedure 'Macro1.'

Any ideas why this is happening?

Matt

Progress Bar Running Access Macro
Hi all,

I have a VB app that runs an MS Access macro in the background. The Access macro runs several queries. I want to show a progress bar on the VB form so that it shows how much longer it takes for the macro to be completed. How can I set the max setting?

Please don't tell me to run the queries in VB, because that's just not how I want to do it. Everything is all set in Access, I'm just creating the front end for it.

FYI, the macro runs for about 15-30 minutes until it's finished.

Any help is greatly appreciated. Thanks a lot.

Martin

Running An Access Macro From A Different Dbase
In our POS dbase I'm currently trying to run a Macro in a second database from a for in the first, I tried the following:
Sub AccessTest1()
      Dim A As Object

      Set A = CreateObject("Access.Application")
      
      A.Visible = False
          
      A.OpenCurrentDatabase ("C:Documents and SettingsDavid ArchibaldMy DocumentsGBL Database ProjectPending.mbd")

      A.DoCmd.RunMacro "GBLPost"
      

   End Sub

But I keep getting "Run-time error '7866': Microsoft Office Access can't open the database because it is missing, or opened exclusivly by another user"
I checked to make sure that there were no other instances of MSACCESS running (other then the one I'm runnning the macro from).  Does anyone know how I can do this?

arch

Running A Access Macro Without VB App Stopping And Waiting
I am running a Access macro from a VB app. Do you have any ideas how I can fire this off while continuing to run the VB app?

Access 2003 Opening Excel File And Not Running Workbook_open Macro How?
Using code below I am opening various spreadsheets and running multiple routines.


Code:
Dim objFileSystem As Object
Dim objFolder As Object
Dim objFilesCol As Object
Dim objFile As Object
Set objFileSystem = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFileSystem.GetFolder(DtR)
Set objFilesCol = objFolder.Files
For Each objFile In objFilesCol
xLs.Workbooks.Open DtR & objFile.Name
xLs.Run "'" & objFile.Name & "'!all"
xLs.ActiveWorkbook.Close savechanges:=False
Next
Set objFileSystem = Nothing
Set objFolder = Nothing
Set objFilesCol = Nothing
Set objFile = Nothing
One of the spreadsheets is doing:

Code:
Workbooks.Open Filename:=EXTERNALSPREADSHEET, ReadOnly:=True, Origin:=xlWindows
This EXTERNALSPREADSHEET sometimes contains workbook_open macro.
How can I prevent this macro from running?

Openning Excel And Running Macro From Word - Macro
Ok - I have a DB which I export to Excel, I then run a macro to "Groom The Data". I then run word and run a Macro (MailMerge to print labels) which retrieves data from the excel spreadsheet groomed above. Everything is working fine, despite my novice knowledge of VB, but I would like to do this in a single click.

I use a command line shortcut to Launch word and automatically have it run the macro, but I still have to Launch Excel and manually run its macro first.

I did not find a command line switch to make excel launch and run a macro. Is there any way I can Lauch Word have its Macro link to excel, then launch and run the excel macros before performing the macro I have set up in word (mailmerge)

In Other Words I have working macros in Word and Excel, I want the Word Macro to force the Excel macro to run before completing the rest of its duties.

Thanks
WW

How Do I Send An Email Thru Outlook 98 Whitout Needing To Have Outlook Running?
Does anyone know how to send an email without needing Outlook running?
I have written this code, which works fine when Outlook is running on my machine, but when Outlook is not running I get a MVB error (see attachment mvberror.jpg). When I hit debug it returns me to; Set ObjOutlookMsg = objOutlook.CreateItem(olMailItem). I cant be having this, please help.

CODE:

Dim response
response = MsgBox("Do you want to send a message to Bev telling her you made a copy of " & lstfiles.FileName, vbYesNo, "STOP")
If response = vbYes Then
Dim objOutlook As New Outlook.Application
Dim ObjOutlookMsg As Outlook.MailItem

Set ObjOutlookMsg = objOutlook.CreateItem(olMailItem)
With ObjOutlookMsg
.To = "user@here.com"
.Subject = "test"
.Body = "Bev, " & vbNewLine
.Body = .Body & "I made a copy of drawing number: ** " & lstfiles.FileName
.Body = .Body & " **, from the Bravo folder. " & vbNewLine & vbNewLine
.Body = .Body & "Thanks"
.Send
End With

Set ObjOutlookMsg = Nothing
Set objOutlook = Nothing




Any help would be greatly appreciated,

Thanks in advance,
el guapo

How To Connect MS Access Running At Local End To MS Access(mdb File) Running On Web
Hello All,

i'm developing a web application that requires data transfer from local system to web server and i know it is possible thru sql server but i wanna use mdb files so please tell me how can i directly send data (like sql server) to web server using mdb file at both ends

Can You Automate Outlook In VB Without Outlook Running?
I give up. I've been looking all day for info about how to automate Outlook in VB without having Outlook running. Whenever you get to the namespace.logon step, it says that it can't find the server. I can't find any way to identify the server to it. Any experts out there?

Running A Macro Sub
I am trying to create a sub that will run for an Excel file. For example:

Private Sub Wheelbase_Range_Click()
Set objExcel = CreateObject("Excel.Application")
Set objBook = Excel.Workbooks.Add
Set objSheet = objBook.Worksheets(1)
Enter Worksheet data here
objWorksheet.Run "Sub Macro1()" (This is where the error occurred)
End sub

Sub Macro1()
Contents of Macro 1 here
End Sub

There is more to the program, but these are the important parts. Any suggestions on how to run this Macro Sub for excel?

Thanks in advance,
Mark

Running A Macro
When I use macros I have only used them for Automating process with Excel.

My question is, how do I make it run a different program...

Example is: Opening up Internet Explorer, and playing a game written in java script (like astroids or something)

I know how to do key strokes, but I know nothing more for making run a program outside of ExCel

Running A Macro From VB6
Hello Everyone

This is time i am almost near to complete my project .. so far what i have done is extracted required information from a text file ,created an excel file and stored that information in sheet of excel ( with the help of VB6 form ) . now i have a macro and i want to run this macro on that very sheet of excel file , can i do it with help of VB6 ?
assume that i have my macro in a text file "macro.txt" at same path .. though i can include that code of macro anywhere in my vb6 code .. and i want to run it on sheet "Results" of Excel workbook "Working" .. placed at same directory .. how would i proceed . a lil code will be appreciable .. rest i ll try to understand though ..

Regards and Waiting

Running A Macro ???
Hi,
I have written a macro in MS Excel. I want to run it as soon as the file is opened by the user. How do I do it?

Kinjal

Macro Running Once
I've got a column of dates which a want to individually change colour depending on the current date. However, I only want the macro to run once on loading of the the worksheet - is this possible, how can I stop the end of the column becoming the active cell and is my code reasonable efficient?

TKS

Louise

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.ScreenUpdating = False
Range("b4").Select
Do Until ActiveCell = ""
If ActiveCell > Now() + 121 Then
Selection.Font.ColorIndex = 5 'Blue
ElseIf ActiveCell > Now() + 30 Then
Selection.Font.ColorIndex = 3 'Red
ElseIf ActiveCell < Now() Or ActiveCell <= Now() + 30 Then
Selection.Font.ColorIndex = 1 'Black
End If
ActiveCell.Offset(1, 0).Range("a1").Select
Loop

End Sub

Running A Macro In Vb
I 'm trying to open a report in vb from a command button tha triggers a macro in access. The command button says to open ru a macro that opens a report. I'm Running Win XP professiona and is in an access 03 file format. When I click the comman button in the VB project. the database is locked exclusively but does not display the report or open access. This was workin for me in a access 97 format, but now I have upgraded to a newe version of access and it is not responding. Any suggestions? Di not change any references that I know of.

Code I use:



Private Sub mnuReport_Click()
Dim objAcc As Access.Application
Set objAcc = New Access.Application
objAcc.OpenCurrentDatabase ("t:sergeydb2.mdb")
objAcc.DoCmd.RunMacro "JCMacro" ' ["test" is a macro which open up a report"]
objAcc.DoCmd.OpenReport ("JCFORM"), acViewPreview

End Sub

Running A Macro Through VB
I am building a VB application which needs to automate aome processes of ER studio. I am using teh automation interface of ER studio to do this.

Now i need to run a macro (.bas file) that is located in a particular directory.
Can someone suggest me a way to run this macro either by using the ER studio automation interface or any other way which uses commands outside teh scope of ER studio.
Note: I know the location of the .bas file.

Thanks!

Running A Macro
Hello all,

I'm having a tough time initiating a macro. My senario is as follows:

Private Sub CostAll_Click()

End Sub


Private Sub RSFCOST_Click()

End Sub

I want the first macro (Cost All) to be able to run the RSCOST macro. Essentially I have 4 unique macros on a sheet that each perform a seperate function, but there are cases where it would be easier to have 1 button click perform all the macros, so I'd like to just have that one button run all four unique macros.

I just can't seem to get the syntex to be right, I think it has something to do with the Private location of the macro(s).

Your help is greatly appreciated.
Adam

Error In Running Macro From VB
Hi I am new to the forum and hoping someone can help me out. I am pretty experianced in writing VBA macros and fairly new to VB but picking it up well. I want to be able to run a program that opens a .csv and runs my macro (which I know works and have been using for a long time) which is in an add in, but I want it to run in the back ground with out the user knowing Excel has opened.

Here is the code I have:
Dim obExcelApp As Object
Dim obWorksheet As Object
Dim obfile, obmac As Object
Dim blnRunning As Boolean

'Trap errors
On Error Resume Next

'Set Excel Application reference
Set obExcelApp = GetObject(, "Excel.Application")

If Err.Number <> 0 Then
Set obExcelApp = CreateObject("Excel.Application")
blnRunning = False
Else
blnRunning = True
End If

'open .csv
Set obfile = obExcelApp.WorkBooks.Open("c:corp.csv")

'run macro
obExcelApp.WorkBooks.Open("O:HomeSpivonkaDevelopmentToolbarMacroT oolbar.xls")
obExcelApp.obfile.Select
obExcelApp.Application.Run ("Interactiveaddsheets")


When it get's to the Call portion I get an error that "a workbook must contain at least one visible worksheet"

Any suggestions? My final goal is to be able to call the macro from a batch file or something similar

Running VBA Macro Without VB Installed
I am trying to run the ffg macro in excel to get the last row index:

Function getlastrow()
Dim intlastrow
intlastRow = Application.CountA(ActiveSheet.Range("A:A"))
MsgBox intlastrow
End Function

it only runs on the machines that have VB installed.
On the ones that does not VB installed, i complains about an Object/Library not found and it points that the error is at line no. 3 of the above code.

Is there any component I need to install on these machines?

Please help

Have A Message Pop Up While Macro Is Running
At present my MS Word Macro uses the following for the Statusbar while the Macro is running.

For indx = 1 To UBound(WordArray)
If InStr(WholeDocument, LCase$(WordArray(indx))) > 0 Then
.Text = WordArray(indx)
.Execute Replace:=wdReplaceAll
End If
StatusBar = "Scanning document, please wait =" & UBound(WordArray) - indx
DoEvents
Next indx
End With

Is there a way I can have something pop up on screen saying "Macro running" and then disappear once the Macro is complete. Or, maybe someone has a better idea?

many thanks
Richi

Running A Macro Automatically
I have a spreadsheet in excel 97 with a dropdown box. Can I automatically start a macro once someone has chosen from the dropdown box?

Word Macro Running Help!
I have a macro that runs everytime a document based on the normal.dot templat is opened (using private sub document_open() ) that sets the margins to 0.5" and paper layout to landscape. I need it to only run on files that begin with a specific name (QC_A1601015_(4numbers here unique to each file).txt eg: QC_A1601015_1234.txt) so how can i put in an 'if filename = QC_A1601015_*.txt then' style command so it checks what the filename is then does the formatting if its right??

Thanks for any possible solutions!

Hide Running Macro
I hate to see excel flashing away whilst my macros run. Is there any way to hide them behind a Blank Screen (preferably with a Status bar on) until they have finished ??

Running A Macro In The Background?
Hi all,

I'm running a Word macro that needs to scan a directory for a file and notify when it arrives.

How can I have it so that it scans in the background and doesn't prevent the user from continuing to work?

Thank you.

Running A Macro From Within A Formula?
I would like to run a macro from within a formula if a certain condition is met, but have no clue how to reference the macro from inside the formula.

example:I am currently working on a spreadsheet that has 7 worksheets in it. most sheets have links to each other which ultimately go back to WS2 (the input sheet).

If a certain cell in WS2 is blank, I want to delete that row in WS3 when the cells are linked. To accomplish this, I was using a IF formula (in WS3) to determine the status of the cell (of WS2), then trying to automatically run a macro to delete the row (in WS3) of the selected cell.I am not sure of the syntax needed in the formula to activate the macro, or if I need to find another method to accomplish this.

Any assistance would be greatly appreciated!

About Stop A Running Macro
how to stop a running macro when pressing a key on keyboard !
like if a macro is running ( doing a loop) , how can i stop it when i press a key "esc" ?

bcuz that's a loop , how can i stop it without effecting other macro (API)

is that possible to achieve that ?

The Last Date A Macro Have Been Running
I ask i f any knows how can I make a simple command that show the last date for one macro (or Buttom) have been pulsed (or run).

if any know I'll appreciate it.

Progressbar During Running Of Macro
I have a couple of questions concerning this idea:
I use a template that runs a macro. This macro takes the information from a .htm file (opened in excel) and places them in the template.
While filling it I want a form to pop-up showing a progress bar.

My questions are:

1. how to use a progress bar (question stated at: general forum)

2. how to have a progress bar do it's job in a pop-up form when the macro is
run : the macro is started and a form should pop up saying: "excel sheet is
being populated" or something : how do I get the macro to continue while
at the same time having the progressbar showing progression.

and third:
3. How can I determine the progression when filling a sheet: how can I tell
when I am at 50 % and when I am done?

So ehmm VBA, winXP, MSoXP

Can anybody help me?

QC

Problem Running A Macro From The Web
I have a macro that graphs the data from a sheet onto a chart sheet in the same workbook. It works great when I run from my PC. But when I run it from the web, after the first graph, which works fine, I get the following when I try to run the graph a second time:
"run-time error 1004: Method 'Worksheets' of object '_Global' failed."

Any ideas?

Thanks,
Joe K

Running A Macro When A Cell Value Changes
Hi
hope somone can help...

How can I get a macro to run when the value in cell b1 changes.
Cell B1 contains a data validation list, and when this changes i want the spreadsheet to update its self.

Any ideas would be appreciated.

Many Thanks

Robin

Using Excel While Macro Is Running
Hi.... I have a timed process that runs every half hour. Using Doevents in a do while loop I can continue to enter data on the worksheet. However, as soon as I try to do anything in another worksheet the macro stops. Any ideas how I can run a automatic timed macro and still use the other sheets in the workbook......THanks


.....................
For i = n To x

dtEnd = timestodo(i, 1)
Do While dtEnd > Now()
DoEvents
If Range("A1") > 0 Then GoTo finishmacro
Loop

newdata = Range("B1:CZ1")

Range("B181:CZ181") = newdata

Running A Macro From Variables
I have the name of the macro and the name of the module which contains the macro in strings.
So I have 2 strings: ModuleName and MacroName
I want to run the macro, how do I do that?

It should be something like
ModuleName.MacroName
but that aint working.

Maybe this can be accomplished with VBE?

Thanks

Running A Macro In A Formula
Hi, I'm new to vb in excel and I am having a problem. I want to create a formula on a cell, so that if the value of that cell is greater than, say 29, it displays a MsgBox letting the user know of their mistype.

I have done it using a macro, but can't workout how to do macro commands in a formula.

It will be used for timecode refferences: i.e. the user will input a timecode (e.g. 09:59:59;30) into a cell, and if the last 2 numbers, (in this case 30) are greater than 29, it will tell the user.

Cheers

D.

Conditional Running Of A Macro
Hi, all

I'm looking for a procedure that will automatically start a macro on condition that the current date is a workday (Monday - Friday), and if so, it should start the macro at a given time.

I know that I can do something like:

If range("A1") >= 2 And range("A1") <= 6 Then
Call MacroABC

But, how is it possible to do this with out making a reference into a workbook? How can one trigger a macro under such conditions?

Hope you can help.

Running A Powerpoint Macro...
Hello,

I cant figure out how to run a powerpoint macro from vb.net

I open the file and then need a macro to be ran.

here is the code i use to open the file:

ppapp = CreateObject("powerpoint.Application")
With ppapp


.Visible = True
ppPres = ppapp.Presentations.Open(FileName:="c:
atiomodelnewchanges.ppt")

End With

************************************
This works fine but I cannot find a command to run a macro that is part of this file...

thanks

Running A Macro Through A VB Script
I have a VB program which runs through a list of excel workbooks and Opens them up, runs a macro, saves and closes the workbook, the problem I am having is that I don't know what the bit of code is needed to run the macro on the excel workbooks.

Can anyone offer any suggestions. Thanks very much

Simon

Running An Excel Macro From Within VB
Hi all,
I need to run a silly little macro from a command button in VB.

This is the macro from excel:

Code:
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 21/01/2002 by MAGrosoft
'
' Keyboard Shortcut: Ctrl+q
'
Range("A1:A6").Select
Selection.Copy
Workbooks.Open Filename:="C:My DocumentsBook2.xls"
Range("A1").Select
ActiveSheet.Paste
Range("C5").Select
End Sub



its just a cut and paste thingy.
what I want is to be able to call that macro from VB
Any suggestions as to how I do that?
could I dim variabvles in this macro (VBA) so that I can change the selections and filenames, and then pass the parameters from VB across to the VBA macro?

Thanks in advance

Macro Running In Background
Hi,
I have a macro running which takes around 10-15min to complete the task.

But, when the macro runs I cannot do any other task or any work on any other excel sheets.

Is there any code or function by which when my macro is running in background I can perform other task in other excel sheets or use other application.

Thanks,
Malay

Running A Macro/form
I have currently the following code written in VB:

Private Sub command1_click()
Dim appAccess As Access.Application

Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase "c: empd1.mdb"
appAccess.DoCmd.RunMacro "Macro1"

End Sub

I run the program click the command1 button and nothing happens, not even an error message.
It should open access and run the macro right?
The macro works fine if I run it directly from Access.

Is there any special configuration I must do in the access macro to allow it be run on VB?

if someone could give me a hand I would be very gratefull.

Joao

I also tried to open a form but again nothing hapened!

Macro Not Running Under CommandButton
In Excel I have been using VB to write macros. I have several Macros running under one CommandButton and all of them work except the following. Running on it's own, not using the command button, this macro runs and does what I want it to. But within the total application, it will not run. By pressing the button I want this macro to open up another existing workbook, populate certain cells, and then retrieve a numerical answer from a given cell back into the original spreadsheet. From that point I want the second workbook to close and not save the changes to it. If you can see what I am doing wrong please help.

Public Sub Macro21()
'
' Macro21 Macro
' Macro recorded 8/13/2003 by Glen Wiebe

' Selects the first cell in the range and copies it
    
    Workbooks("Mysheet.xls").Activate
    Range("E13").Select
    ActiveCell.Copy
    
    
'Set a flag to check to see if target spreadsheet is already open
'If open it activates it, if not open it opens and activates it
    flag = True
    For Each w In Workbooks
        If w.Name = "Othersheet.xls" Then
                flag = False
        End If
    Next w
    If flag = True Then
        Workbooks.Open "C:Othersheet.xls"
    End If
    
    Range("F13").Select
    Application.CutCopyMode = False
    ActiveCell.Copy
    
    Workbooks("Mysheet.xls").Activate
  
'Pastes only the value into the cell
    With Worksheets("Sheet1")
        .Range("H96").PasteSpecial Paste:=xlPasteValues
    End With

'Closes all workbooks except this one
    For Each w In Workbooks
        If w.Name <> ThisWorkbook.Name Then
            w.Close savechanges:=False
        End If
    Next w
End Sub

 

Running Excel Macro
Hi,
How can I call an Excel macro and pass a parameter to it from my vb code? I used
Set ApExcel = CreateObject("Excel.sheet")
ApExcel.Application.Run "PERSONAL.xls!getStats"
but how can I change the code to pass in a parameter?
Thanx!

Outlook Macro Help
I am trying to figure out how to create a macro or tool bar button that when ran, takes the currently selected email and forwards it to a predefined address. I thought before I start from scratch, I would check here to see if anyone has already done something like this?

Outlook Macro
I have created a macro in Outlook, complied, and saved it. It will not show up in the Macro list. I have lowered the Security levels, restarted Outlook, and it will not show up. Any suggestions???

Outlook Macro
Hi All!

I know this kind-of-question has been asked before, but this one's different.

I would like to move all messages in public folder (exchange): X to folder Y.
But, before it moves the message I would like to save the attachments of the message to let's say: C:Attachments.

Can anyone please help me with this?
I can't seem to figure this out; i'm also not very familiar with Outlook macro's.

I've been trying this for a few hours already, so help would be greatly appreciated.
Thanks a lot!

Kevin,

Copyright 2005-08 www.BigResource.com, All rights reserved