Calling A MSAccess Macro
Is there a way that I can call a MSAcess macro in a closed database from VB 6.0? Thanks for any help.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Calling MsAccess Report From VB
<html><div style='background-color:'><DIV>
<P>hello</P>
<P>i am a new member in this service.</P>
<P>i just wanted to ask if u can help me, "is it possible to call Ms-Access pre-formated report from vb and show in vb application". like the same way we can call crystal report or we can make data report in the application.</P>
<P>regards</P>
<P>Haroon</P></DIV></div><br clear=all><hr>Get your FREE download of MSN Explorer at <a href='http://g.msn.com/1HM100901/155'>http://explor er.msn.com</a>.<br></html>
Executing MSAccess Macro From Webpage?
Here is what I'm trying to do....
An MSAccessXP database has reports for various avery labels, the data for which is stored in various tables. I need users to be able to go to our company website select a few options and be able to print the labels online.
Between general formatting issues and Avery.com, I decided to create PDF's which seem to cure the formatting issues. So right now I can print the reports to Adobe Distiller (PDF maker) and serve up a PDF file for the browser.
What I am looking for is a way through scripting to be able to activate an Access macro to create the PDF automatically each time somebody wants to print labels, as the labels data can change any day.
So basically I'm looking for a way to activate the macro through VBscript. Anyone have any idea of what commands I should be researching? or perhaps knows of any examples?
TIA
Andrzej (Andy) Raczynski
Calling A Macro
How can i call a macro as soon as a form is loaded from outlook?
Calling A Macro...
Hi all,
I need to call ADD-IN and use one of its functions to run on a workbook that is opened from VB6.
I have noticed that when VB opens an instance of Excel it does not open the ADD-IN's that would have opened with it if it was opened as a Normal App.
How can I call this ADD-IN without having to copy its code across to the app I am writing.
Any help advice would be great....
Thanks in advance
[Edited by Rocks on 01-04-2001 at 11:43 AM]
Calling A Macro From A Macro
Hi
I am writing a macro within Excel. I want this to invoke a word object:
Dim obj As Object
Set obj = CreateObject("Word.Application")
obj.Visible = True
And then maybe load my template file, and call a macro within that. Basically, I want to create a mail merge autoamtically from the data in the Excel file at the touch of a button.
Regards
Ben
Easy One - Calling Macro From Another
I'm writing a macro which goes through each shape, header and footer in a Word document individually and runs an external macro on it. This external macro was not written by me and I've no access to the code.
So I have the macro loop through all the objects in question and call the macro with Run, but the whole thing seems to stop running after the Run statement, and the macro appears to run on the whole document, excluding the headers and footers. Should I be using something else rather than Run?
VB Code:
Sub CleanWholeDocument() Dim sShape As ShapeDim fNote As FootnoteDim HeadFoot As HeaderFooterDim sSection As Section For Each sSection In ActiveDocument.Sections For Each HeadFoot In sSection.Headers HeadFoot.Range.Select Application.Run MacroName:="tw4winClean.Main" Next HeadFootNext sSection For Each fNote In ActiveDocument.Footnotes fNote.Range.Select Application.Run MacroName:="tw4winClean.Main"Next fNote For Each sShape In ActiveDocument.Shapes If sShape.TextFrame.HasText Then sShape.TextFrame.TextRange.Select Application.Run MacroName:="tw4winClean.Main" End IfNext sShape Application.Run MacroName:="tw4winClean.Main" End Sub
Calling An Excel Macro From VB
I've posted my code in an attempt to get some help. The line - "xl.run OverallLoop" is an attempt to call a macro in an excel application. It doesn't seem to be working. Can anyone help? ps thanks to the guys who helped before!
Sub VBOverallLoop()
Dim ThisOpenPath As String, NRuns As Integer, Age As Integer
Dim VBThisFileName As String, NPats As Integer, PatAge As Integer
Dim i As Integer, j As Integer
NRuns = frmDiab.txtNRuns
NPats = frmDiab.txtNPats
ThisOpenPath = "c:PTDMMHDiab.xls"
Set xl = New Excel.Application
Application.Visible = False
Set xlWorkbook = xl.Workbooks.Open(ThisOpenPath)
Set xlWorksheet = xlWorkbook.Sheets("TherapyParams")
xlWorksheet.Activate
Set xlNumbTherapy = xlWorksheet.Range("NumbTherapy")
InitialTime = Timer
For i = 1 To NRuns
For j = 1 To 1 ' replace with xlNumbTherapy
frmDiab.lblProgress.Caption = "Run " & i & ", Therapy " & j & ""
Set xlWorkbook = xl.Workbooks.Open(ThisOpenPath)
Set xlWorksheet = xlWorkbook.Sheets("OtherParameters")
xlWorksheet.Activate
Set xlRangeDiabFlag = xlWorksheet.Range("RngDiabFlag")
Set xlRangeNPats = xlWorksheet.Range("RngVBNPats")
Set xlRangeFileName = xlWorksheet.Range("RngFileName")
Age = xlWorksheet.Range("RngAgeForVB").Value
xlRangeDiabFlag.Value = j
VBThisFileName = "Therapy" & j & "Run" & i & ""
xlRangeFileName.Value = VBThisFileName
xlRangeNPats = NPats
xl.Run OverallLoop
'Call DeleteSheets
temptxt = "c:PTDM" & VBThisFileName & ".xls"
xlWorkbook.SaveAs temptxt
Next j
Next i
xlWorkbook.Close
xl.Quit
Set xl = Nothing
Set xlWorksheet = Nothing
Set xlWorkbook = Nothing
If Timer - InitialTime < 300 Then
ThisTimeTaken1 = Int(Timer - InitialTime)
ThisTimeTaken2 = "seconds"
Else
ThisTimeTaken1 = Int((1 / 60) * Int(Timer - InitialTime))
ThisTimeTaken2 = "minutes"
End If
frmDiab.RunButton.Enabled = False
frmDiab.Show
frmDiab.lblProgress.Caption = "Done in " & ThisTimeTaken1 & " " & ThisTimeTaken2
frmDiab.FinishButton.Enabled = True
End Sub
Calling A Macro In A Different Project
Hi
I have a macro within Excel which opens all workbooks within a specified folder. For each of these workbooks I need to call a macro that exists within the workbook.
I'm having problems getting VBA to do the call using a variable as the workbook name (the module & macro names can be specified as a constant). In fact I'm even having problems doing the external call when I explicitly write out the workbook name in the call.
Thanks for your help.
Calling A Macro From Another File
Dear Friends,
How do i call a macro from another file? For example, I want to write a macro in "c:ook1.xls" which will call a macro(sub test()) present in "d:ook1.xls".
Requesting your kind help in this regard.
Regards,
S. Sivakumar
Calling External Excel 4 Macro
Is it possible to call an external excel 4 macro from VB? We have a very complicated macro that doesn't seem to have an equivalent in VBA, and I need to incorporate it into my VB program...anyone have any knowledge of this?
Thanks!
Calling Macro In Excel From Access With Vba
HI
Im new here, this is my first question and I hope someone out there can lend me hand or point me in the right direction. Thanks.
I have developed an Excel template with a macro in VBA. I have ten different templates which I want to fire off. At the moment, all ten is fired off from Access using a shell command, but Im finding that it uses too much virtual memory. The ten templates are all the same except using different parameters, so I am thinking of just having one template and using the Access to call up a template and passing in the parameter so the macro can act on it using that parameter. Is there a way of calling a macro function in Excel using vba?
Anyone got any advice, will be greatly appreciated.
Cheers
Calling Access Macro From Excel
I have a model, running from a macro in Excel. The model cycles through hundreds of thousands of iterations for forecasting purposes. I am taking the output from the model after each iteration and dumping it into Access.
I am experiencing two problems calling the Access macro (that imports the data and places it in the appropriate table) from Excel:
1.) The database connection times out. The speed of the Excel macro is drastically reduced if I open Access after each iteration to dump data in. Therefore I have connected to Access in the beginning of my Excel macro and am only calling the Access macro after each iteration. I tried to open and close the database with each iteration, but it is time consuming and sometimes the database doesn't close which causes the program to halt.
2.) I call the Access macro in the following manner:
In the beginning of the macro the following is established:
Dim cn As New Access.Application
cn.OpenCurrentDatabase ("C:
ame.mdb")
cn.Visible = False
Then after each iteration:
SendKeys "MacroName{ENTER}"
cn.RunCommand acCmdRunMacro
Then at the very end:
cn.CloseCurrentDatabase
cn.Quit acQuitSaveNone
Set cn = Nothing
The problem is with the "SENDKEYS" statement. Sometimes, about 1% of the time, the macro seems to skip over the line. The macro window will open in Access prompting me to enter the macro name and "ENTER".
Any wisdom that could be imparted regarding these two issues would be greatly appreciated! Thanks for your help.
Calling Access Macro Problem
Is there anyway to keep access from popping up while doing the snippit below?
'Open database
objaccess.OpenCurrentDatabase "my database"
Thanks
In Excel, Calling Word Macro
Please Help, i have gotten this far and am stuck: I have an Excel Macro that copies a specific cell, and it then needs to call a Word macro to paste the contents. I know the copy/paste commands, but am having trouble calling the Word Macro. Any help would be appreciated, for i am tearing my hair out
Need Help With Calling Macro Automatically <RESOLVED>
I'm currently using vb in excel to do several tasks, although one troubles me. I would greatly appreciate some sort of insight in this matter. Im trying to print the spreadsheet at midnight. The printing is no problem, i just call on a macro to do that. The issue arises with how to call that macro at midnight. Ive tried several ways including an ondata command, but have found no way to check the time, to call the macro automatically from either the spreadsheet or a command. Any help would greatly be appreciated....
Edited by - flopro on 6/14/2004 2:18:07 PM
Calling Microsoft Access Module Or Macro From VB
I would like to call a Microsoft Access Module or Macro from a VB executable. This way I could schedule some database activity from my NT server.
I do not know the commands to open an Access Database (with password protection) and us the DoCmd.
Please Help!!
Calling A Macro In Another Template In Word 2000
GOod day,
I am trying to call a macro in a template that I attach a run-time and the error I get keeps telling me that it is unable to run the specified macro...the code is as follows
Code:Sub ApplyNewTemplate()
' attach the new Signature template to override styles
With ActiveDocument
.UpdateStylesOnOpen = True
.AttachedTemplate = _
"C:WINNTProfiles" + Environ("USERNAME") + "Application DataMicrosoftTemplatesSignature.dot"
End With
Quote:THE ERROR OCCURS HERE...Should I be using another method?
' auto-run the conversion to the new look after the signature template is attached
Application.Run MacroName:="Signature.NewLook.NewLookSignature"
End Sub
Thanks in advance...
J.C.
"Do or do not, there is no try."
Calling An Excel Macro From An Access Database That Refers To That Database
hi
i have a macro in excel that inserts some values into a table in a database in access, but i want to make it so i dont have to touch the excel file, instead i have a module in the access file that calls the sub in the excel file, but then i get an error saying that the database is already open....is there a way of getting around this?
thanks
jimmyp
Word Macro Insert File/ Append Table Macro Issue.
Hello,
I was wondering if someone could help me with this problem...
When I use the following code to insert a table (from an external file), the table that is inserted does not append to the table in first document (which is what I want it to do)...
Sub Macro1()
Selection.Collapse Direction:=wdCollapseEnd
Selection.InsertFile FileName:="m:cat.DOC", Link:=True
End Sub
Would anyone know how I can make the contents of this file append to the table in the first document?
Thanks so much in advance,
Anne
Macro Opens A Document In Vba, Saves, Then Continue With Macro
Maybe the title isn't correct, but i've got the following problem.
I build a document that open a form. On this form there is a checkbox. When the checkbox is active and I press 'OK' a document has to be opened. On this document some changes can be made, then by pressing 'continue' this document is saved on 'c: emp' and closed. Then I want to go back to the first document and continue with it.
Is there some sort of halt or wait funtion to establish this?
The code I use is the following:
<code document1>
If chbFinPar = True Then
Documents.Open FileName:="f:Nieuwe format macroHuisstijlTestversiefinpar.doc"
Selection.EndKey , ActiveDocument.Bookmarks("bmkfinpar").Range
Selection.InsertFile FileName:="c: empfinpar.doc"
End If
<end code>
<code document2>
Private Sub cmdVrdr_Click()
ActiveDocument.SaveAs ("c: empfinpar.doc")
ActiveDocument.Close
End Sub
<end code>
Word Macro Editor Opens When I Misspell A Macro Name
I'm using Word 2000, and pressing Alt+F8 to access macros - just text strings - and here's the trouble:
I'm trying to make it possible for everyone here to use Word macros from the server. I've put a file out there called Macros.dot and it works great. Every machine in the building can see it and use it. Trouble is, if a user misspells a macro name the macro editor opens by default. It doesn't realize the user has misspelled something and thinks the user wants to write a new macro under the "new" name. User can click the X to close the editor, of course, but has now created a blank macro with a name very similar to a real macro. This will drive people (especially the less tech savvy) nuts, and clog up the file Macros.dot with garbage.
Is there a way to disable the macro editor from opening if an incorrect (nonexistent) macro name is typed? A check box somewhere, perhaps? I've tried but can't seem to find it, if it's there.
Thanks
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 To Hide Macro Option From Tools Macro, Macros
Hi,
Well, this is the situation. I created some macros (6) for a workbook. One this macros is adding a new Menu in the main Excel Menu. The idea is that the user does not need to go to options: Tools, Macros, Macro...and run the macro because I want them to do it from the menu specially created.
Also I prevented any user to edit the macros putting password if they want to see the codes.
Now How I can prevent a user to run all my macros from the option:
Tools, Macros, Macro...Can I hide a Macro from that menu?
Any way to remove this option in just this workbook not affecting the user if they want to work with a new one...?
Or may be a message saying that macro can be run from the menu if the user is trying too.
Any suggestion?
Thanks!
Gonza
Calling C++ DLL - Invalid Calling Structure
First i got a could not find entry point in DLL error. i fixed that by specifying ordinal numbers in the VB app. now when i run the program i get an invalid calling structure error and then VB Studio crashes. I think the crash is do to the threading and debugging at the same time. i have heard about problems with that. how do i fix the invalid calling structure error.
HEADER ------------------
#ifdef DLL_EXPORTS
#undef EXPORTMODE
#define EXPORTMODE __declspec(dllexport)
#else
#undef EXPORTMODE
#define EXPORTMODE __declspec(dllimport)
#endif
EXPORTMODE bool StartThread(int nTime, int nInterval);
EXPORTMODE void StopThread();
SOURCE---------------------------
#include "stdafx.h"
#include "header.h"
BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
EXPORTMODE bool StartThread(int nTime, int nInterval)
{
return true;
}
EXPORTMODE void StopThread()
{
}
Word 200 Vba Macro Help - Enable Track Changes In A Macro. Thanks
I was able to find a macro which takes an already mail merged document, and saves each each document as a separate file. The document's filename is taken from the already merged document. The script works. It's in red. See below.
The problem is I need to enable the track changes option.I recorded the following macro. It's in blue.
With ActiveDocument
.TrackRevisions = True
.PrintRevisions = True
.ShowRevisions = True
End With
End Sub
I tried to incorporate this code(blue) into the code (red) below. I added it between ActiveDocument.Sections.First.Range.Cut and Documents.Add but it didn't work.
ActiveDocument.Sections.First.Range.Cut
ActiveDocument.TrackRevisions = True
ActiveDocument.PrintRevisions = True
ActiveDocument.ShowRevisions = True
Documents.Add
It turned on track changes but it didn't create each new document. What am I doing wrong?
Desperately Seeking help!!
Script works perfectly.
Sub SplitMergeLetter()
' splitter Macro
' Macro created 16-08-98 by Doug Robbins to save each letter created by a
' mailmerge as a separate file.
'
Selection.EndKey Unit:=wdStory
Letters = Selection.Information(wdActiveEndSectionNumber)
Selection.HomeKey Unit:=wdStory
Counter = 1
While Counter < Letters
Application.ScreenUpdating = False
Selection.HomeKey Unit:=wdStory
Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend
sName = Selection
'set path below
sPath = "C:MERGELETTERS"
Docname = sPath & sName
ActiveDocument.Sections.First.Range.Cut
Documents.Add
With Selection
.Paste
.EndKey Unit:=wdStory
.MoveLeft Unit:=wdCharacter, Count:=1
.Delete Unit:=wdCharacter, Count:=1
End With
ActiveDocument.SaveAs FileName:=Docname, _
FileFormat:=wdFormatDocument
ActiveWindow.Close
Counter = Counter + 1
Application.ScreenUpdating = True
Wend
End Sub
Calling An Oracle Package.Procedure Works But Calling A Function In The Package Does Not ?
Hi,
I am trying to call a function in a package in Oracle, from VB. I am using the traditional ADODB with connection, command and parameter objects. The function has 6 input parameters and it returns a string value.
We have no problems reaching the similar Procedure under a package, but when it comes to accessing the function, it gives errors. I got "no descriptor found", after some changes "object stored Procedure does not exist" .
Any suggestions on how differently to access a function within a package as opposed to a procedure ?
Thanks,
Arch
Call Macro ~change Macro
I want to create a print preview from a access rapport
I'm using this code:
Code:
Private Sub Command1_Click()
Dim A As Object
Set A = CreateObject("Access.Application")
A.Visible = true
A.OpenCurrentDatabase (App.Path & "
ewP2.mdb")
A.docmd.RunMacro "macroprinten"
ENd SUb
the first macrocommand is openreport + report name
at this instruction there is a posibility to specify a WHERE instruction.
Is it posible to chance this where instruction in visual basic
?
Many thx
grz
EBS
Run Access Macro From Excel Macro
Hi
I am using Microsoft Office 2000 and trying to run an Access macro from an Excel macro, but my Excel macro does not seem to be working. When I run the Excel macro, nothing happens - I do not get an error and the code does not do what it is suppossed to. Below is my code:
Code:
Sub DisplayForm()
' Initialize string to database path.
Const strConPathToSamples = "C:Miscell est.mdb"
strDB = strConPathToSamples & "test.mdb"
' Create new instance of Microsoft Access.
Set appAccess = _
CreateObject("Access.Application")
' Open database in Microsoft Access window.
appAccess.OpenCurrentDatabase strConPathToSamples
' Run Access macro.
appAccess.DoCmd.RunMacro "Macro1", 1
End Sub
I have included the references to "Microsoft DAO 3.6 Object Library" and "Microsoft Access 9.0 Object Library."
Any help on this subject would be much appreciated.
Thanks
Modifying Macro Or Form With Macro
Is it possible to modify a userform or macro in a module with another macro?
I've got a database of clients that will probably have new clients from time to time. Currently using userforms to give check lists and of course that stuff is referenced in macros. Would be cool to write a macro that would allow a user to modify that stuff to add in choices as needed.
Can this be done?
Attatch A Macro To A Button With A Macro?
I am creating a new sheet using VBA, I would like to be able to add a button to this sheet (which I can do), and attach a macro to the button (which I cannot).
Can anyone tell me how to attatch a macro to a button using another macro? Or any other way of making the newly created button actually do anything?
Thanks!
-Shiv
Calling A DLL Function...is This A "calling Convention" Problem?
Hi All, I'm not sure if this has been covered in another thread. I'm trying to call a function in a DLL that was written in C++ and its saying it can't find the entry point, I've got the case and spelling correct.
Heres the C++ example code of how to call it:
LONG DLLFUNC RotorRadioConfigure ( HWND, HANDLE );
and heres my VB code:
public Declare Function RotorRadioConfigure Lib "rr.dll" HWND, HANDLE) as Long
I've also tried using ordinal calls:
public Declare Function RotorRadioConfigure Lib "rr.dll" Alias "#1" (HWND, HANDLE) as Long
But, I don't know which ordinal number to use, I've tried #1 to #8, then VB crashes, there are about 15 functions in the DLL.
On each ordinal call, it just says invalid calling convention.
Any help?
Scott.
---
Freeware VB programs at http://net23uk.freeservers.com
Calling A Sub In The Calling Program
Can a sub form call a sub/function in the calling program?
I want to refresh some details in the calling program BEFORE the called program exits.
Thanks
Vb In MSACCESS
I do not know alot about vb but am trying to learn.
i have MSaccess 2000 and know that there is some vb program in there. what version of vb is this or is it simply vb as apposed to vb 4,5,6.
MSAccess And VB6
Hi,
I am programming in VB6. I have an AP that prints a report with Access 97. When I put the executable code on a PC with Access 2002, the report fails. I've seen posts saying that I need MSACC9.OLB, but that does not show up as a choice in my Reference list. How can I get it?
Thanks,
MSACCESS.Exe
When I choose an item on a Combo box on Form, I get the following message:
"MSACCESS.Exe has generated errors and will be closed by Windows. You will need to restart the program.
An error log has been created."
Where would I find the error Log and what do you make of this message?
Regarding Msaccess
hi
i am using
Dim oapp As Access.Application
how can i open a existing database apart from using opencurrentdatabase?
regards
vivek.s
Vb && Msaccess
Hi,
I have installed an application developed in VB 6.0 with MS-Access 2000 as the back end in a network of 25-30 systems. The application was working fine for a couple of days without any concurrency problems. But after 2 days, the database crashed, i.e., when I tried to open the database which is password protected, it shows the following message:
Could not open database. Database is in unrecognized format.
I couldn't open the database at all. So the application couldn't be used without the database.
Is it because of the large number of users accessing simultaneously across the network or has it got to do with something else? Plz reply. TIA.
Ravi.
MsAccess
How do u convert MS Access Database(mdb) to
Ascii
format?
VB And MSAccess HELP
i have VB form and i am connecting to MSAccess but the problem is i have 3 checkbox's in vb and the same field in my database i have checkbox so when user check the checkbox
in vb and click on SAVE it will check the checkbox in my database if user uncheck the box and SAVE it will uncheck the box in my Access database the name of database is meter.mdb . How do i do this ?
Thank you.
Pls Help Me IN VB/MSACCESS
hai !!! I AM MURALI FROM CHENNAI, INDIA
I WANT TO KNOW HOW TO VIEW THE TABLES IN MSACCESS FROM VISUAL BASIC 6.0 I AM USING THE CONTROL <LIST1> FOR VIEWING THE MSACCESS DATA FILE ie. *.mdb.
ex: MSACCESS File name is LC.mdb
Tables in the above data file
1. abc 2. zyx
i want to view the above said 2 tables through VB
Kindly help me in solving the problem. you may mail the
coding to knmurali@lgfl.com
THANK YOU
|