473,795 Members | 3,295 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Opening macros in design mode with code

Hi

I am writing a tool to extract form, report, properties to a
XML format for further analysis (cross referencing etc) using Python.

Reports and Forms can be accessed using AllForms, AllReports
and DoCmd to open them in design mode but
Although there is a collection "AllMacros" there does not seem
to be a way using DoCmd to gain access to the macros collection.

Any help appreciated.

Aug 20 '06 #1
2 3303
There is an undocumented pair of commands to export a macro as a text file,
and import a text file to a macro. Whether you can modify the text file in
between, I can't say, but if you are interested try SaveAsText and
LoadFromText.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"neib" <ge*******@gmai l.comwrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.com.. .
>
I am writing a tool to extract form, report, properties to a
XML format for further analysis (cross referencing etc) using Python.

Reports and Forms can be accessed using AllForms, AllReports
and DoCmd to open them in design mode but
Although there is a collection "AllMacros" there does not seem
to be a way using DoCmd to gain access to the macros collection.

Any help appreciated.

Aug 20 '06 #2
Allen Browne wrote:
There is an undocumented pair of commands to export a macro as a text file,
and import a text file to a macro. Whether you can modify the text file in
between, I can't say, but if you are interested try SaveAsText and
LoadFromText.
Thanks the following works well:
from win32com.client import Dispatch
from win32com.client import constants
import os.path

exportPath =r'c:\temp\expo rted'
databaseName =r'c:\data\jabu lani asset finance\Current \AmDeals02.mdb'

access=Dispatch ('access.applic ation')
access.Visible= 1
access.OpenCurr entDatabase(dat abaseName,0)
proj = access.CurrentP roject

acConsts={'Tabl es' :constants.acTa ble,
'Queries':const ants.acQuery,
'Modules':const ants.acModule,
'Reports':const ants.acReport,
'Scripts':const ants.acMacro,
'SysRel':None,
'DataAccessPage s':None,
'Relationships' :None
}

saveAsText = access.Applicat ion.SaveAsText

def exportAll():
db=access.Appli cation.CurrentD b()
for container in db.Containers:
containerName = container.Name
print containerName
documents = db.Containers(c ontainerName).D ocuments
if not acConsts.get(co ntainerName,Non e):
continue
for doc in documents:
docName=doc.Nam e
try:
saveAsText(acCo nsts[containerName],
docName,
os.path.join(ex portPath, containerName,
docName+'.txt') )
except Exception,e:
print str(e)

if __name__=='__ma in__':
try:
exportAll()
except Exception,e:
print str(e)
access.Applicat ion.Quit()

Aug 20 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
2425
by: mike420 | last post by:
Tayss wrote: > > app = wxPySimpleApp() > frame = MainWindow(None, -1, "A window") > frame.Show(True) > app.MainLoop() > Why do you need a macro for that? Why don't you just write
2
1682
by: Greener | last post by:
In addition to the previous questions, I wonder, if opening an Excel file in NON-read-only mode, would the macros on the worksheets work as well? Thanks millions! Helena
0
1040
by: KS | last post by:
I have a class file, A, that inherits a SpecPanel that inherits Panel. When I try to open A in I gets an error: A red cross and a some text and something about "Constructor on type WindowsApplication1.clsSpecVegtSkaal not found" I can't remenber writing a constructor nor that I have deleted one and for a long time it DID work - I can view the class file i 'code mode' but not in design
4
2630
by: Jelmer | last post by:
Hi I've been trying to create an addin similar to Find & Replace from Rick Fisher that looks thru your tables / queries / forms / modules etc.. for a reference to a string and optionally let's you replace it. In order to get this to work I need to get - the tablenames and columnnames - the queries in plaintext - the properties of a form and the properties of elements contained within it
4
5892
by: Jeff | last post by:
I have a need to open a report in design mode immediately before opening it in preview, to change the Minimum and Maximum scale on an axis on a chart. This results in a flash of the report in design mode just before it is opened in preview mode. Is there any way to open it in design mode hidden? Jeff
9
2562
by: MLH | last post by:
Say I open a form (MyForm) in design view, then I close it and dbl-click it in the database window to open it. Shouldn't the Activate event occur in all such situations? What might the case(s) be if the Activate event does NOT fire?
5
2892
by: reubmeg | last post by:
I have a client who is having problems opening up queries in design mode. When the datafile that the query is looking at is in use by someone else, it takes up to a couple of minutes to open. I am pretty sure this is not a network problem or a computer speed problem, as they are using gigabit LAN and the database is being stored on a brand new zeon server with 2 gig of RAM, which is not used for anything else! He thought it might be due to...
0
860
by: pintu | last post by:
Hi dear friends.. I hav a problem while using .net 2005..am working in asp.net 2.0. Now the problem is that i am unable to open the design mode of any .aspx page. i am only able to access the code behind and the source view(html mode) of that page...Again while working on that page's source view am unable to delete anything by either using delete or backspace key..So wht might be the problem plz let me know.and also the possible...
16
5192
by: Phil Stanton | last post by:
I have a form with a button which is supposed to open an Excel file (With lots of Macros /VBA) in it. The Excel file gets it's data from the Access program Here is the code Private Sub Storage_Click() On Error GoTo Err_Storage_Click
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10213
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9040
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.