473,612 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Module Help!

I would like to add the xls macros below to the module listed. I am
looking for advice as to the best way to go about this.

module
Public Function clean_pn(pn_in As Variant) As String
End Function
Dim pn_out As String
If IsNull(pn_in) Or pn_in = "" Then pn_in = "000"
If pn_in = "VEBA" Then
pn_out = "001"
Else
pn_out = pn_in
End If
clean_pn = pn_out
End Function
Public Sub export_schd04(s XlsPathRoot_P As String, sXlsPathRoot_D As
String, sXlsPathRoot_H As String)
Dim sFundNum As String
Dim sXlsFilePath As String
Dim qdGenXlsTbl As QueryDef
Dim qdDelXlsTbl As QueryDef
Dim rsFundList As Recordset
Dim rsPIW As Recordset
' Dim xlsapp As Application
Dim xlsApp As Excel.Applicati on
Dim xlsWorkBk As Excel.Workbook
Set xlsApp = New Excel.Applicati on
Set rsPIW = CurrentDb.OpenR ecordset("t_piw **_export_2004" )
Set rsFundList = CurrentDb.OpenR ecordset("schd_ **fund_list")
Do Until rsFundList.EOF
sFundNum = rsFundList(0)
'
' Do Schedule D
'
Set qdDelXlsTbl = CurrentDb.Query Defs("schd_purg **e")
qdDelXlsTbl.Exe cute
Set qdGenXlsTbl =
CurrentDb.Query Defs("load_schd **_2004_Part1")
qdGenXlsTbl.Par ameters("prm_fu **nd_num") = sFundNum
qdGenXlsTbl.Exe cute
sXlsFilePath = sXlsPathRoot_D & "04d" & sFundNum & "a.xls"
DoCmd.TransferS preadsheet acExport, acSpreadsheetTy peExcel4,
"t_schd_export_ 2004", sXlsFilePath
Set xlsWorkBk = xlsApp.Workbook s.Open(sXlsFile **Path)
xlsWorkBk.Works heets(1).Column **s(1).Delete
xlsWorkBk.Works heets(1).Rows(1 **).Delete
xlsWorkBk.Save
xlsWorkBk.Close
Set qdDelXlsTbl = CurrentDb.Query Defs("schd_purg **e")
qdDelXlsTbl.Exe cute
Set qdGenXlsTbl =
CurrentDb.Query Defs("load_schd **_2004_Part2")
qdGenXlsTbl.Par ameters("prm_fu **nd_num") = sFundNum
qdGenXlsTbl.Exe cute
sXlsFilePath = sXlsPathRoot_D & "04d" & sFundNum & "b.xls"
DoCmd.TransferS preadsheet acExport, acSpreadsheetTy peExcel4,
"t_schd_export_ 2004", sXlsFilePath
Set xlsWorkBk = xlsApp.Workbook s.Open(sXlsFile **Path)
xlsWorkBk.Works heets(1).Rows(1 **).Delete
xlsWorkBk.Save
xlsWorkBk.Close
'
' Do Schedule H
'
Set qdDelXlsTbl = CurrentDb.Query Defs("schh_purg **e")
qdDelXlsTbl.Exe cute
Set qdGenXlsTbl = CurrentDb.Query Defs("load_sch_ **h2004")
qdGenXlsTbl.Par ameters("prm_fu **nd_num") = sFundNum
qdGenXlsTbl.Exe cute
sXlsFilePath = sXlsPathRoot_H & "04h" & sFundNum & ".xls"
DoCmd.TransferS preadsheet acExport, acSpreadsheetTy peExcel4,
"t_schh_export_ 2004", sXlsFilePath
Set xlsWorkBk = xlsApp.Workbook s.Open(sXlsFile **Path)
xlsWorkBk.Works heets(1).Rows(1 **).Delete
xlsWorkBk.Save
xlsWorkBk.Close
'
' Do Plan Information Worksheet
'
' rsPIW.MoveFirst
' rsPIW.Edit
' rsPIW.Fields("g ") = Mid(rsFundList. Fields("fund_ei **n"),

1,
2)
' rsPIW.Fields("h ") = Mid(rsFundList. Fields("fund_ei **n"),

3,
7)
' rsPIW.Fields("i ") = Left(rsFundList .Fields("fund_n **m"),

48)
' rsPIW.Fields("j ") = Left(rsFundList .Fields("fund_n **m"),

48)
' rsPIW.Update
' sXlsFilePath = sXlsPathRoot_P & "p" & sFundNum & ".xls"
' DoCmd.TransferS preadsheet acExport, acSpreadsheetTy peExcel4,
"t_piw_export_2 000", sXlsFilePath
' Set xlsWorkBk = xlsApp.Workbook s.Open(sXlsFile **Path)
' xlsWorkBk.Works heets(1).Rows(1 **).Delete
' xlsWorkBk.Save
' xlsWorkBk.Close
rsFundList.Move Next
Loop
MsgBox "Files Generated", vbOKOnly, ""
End Sub
------------------------------**-----------------------------*-*-------

xls macro A
Sch_D Part 1.
Sub CreateFile()
Dim SN, LN As Variant
Dim Counter, SR, SC As Integer
'SN = Start Name, LN = Last Name, SR = Start Row, SC = Start Column
Application.Scr eenUpdating = False
Application.Dis playAlerts = False
Application.Ref erenceStyle = xlR1C1
LN = Range("A65536") .End(xlUp).Row
SR = 9
SC = 1
Counter = 0
For SN = 9 To LN
Range("A" & SN & ":D" & SN).Select
Selection.Copy
Cells(SR, SC).Select
ActiveSheet.Pas te
SC = SC + 4
Counter = Counter + 1
If Counter = 8 Then
SR = SR + 1
Counter = 0
SC = 1
Else: SR = SR
End If
Next
Application.Ref erenceStyle = xlA1
Range("AG" & 9, "AG" & SR) = "~5x4"
Range("A" & SR + 1, "D" & 65536).Select
Selection.Clear Contents
Range("A1").Act ivate
Application.Scr eenUpdating = True
Application.Dis playAlerts = True
End Sub
------------------------------**-----------------------------*-*-------

xls Macro 2
Sch_D_Part 2
Sub createfile_2()
Dim SN, LN As Variant
Dim Counter, SR, SC As Integer
'SN = Start Name, LN = Last Name, SR = Start Row, SC = Start Column
Application.Scr eenUpdating = False
Application.Dis playAlerts = False
Application.Ref erenceStyle = xlR1C1
LN = Range("A65536") .End(xlUp).Row
SR = 9
SC = 1
Counter = 0
For SN = 9 To LN
Range("A" & SN & ":F" & SN).Select
Selection.Copy
Cells(SR, SC).Select
ActiveSheet.Pas te
SC = SC + 6
Counter = Counter + 1
If Counter = 6 Then
SR = SR + 1
Counter = 0
SC = 1
Else: SR = SR
End If
Next
Application.Ref erenceStyle = xlA1
Range("AK" & 9, "AK" & SR) = "~3x4"
Range("A" & SR + 1, "F" & 65536).Select
Selection.Clear Contents
Range("A1").Act ivate
Application.Scr eenUpdating = True
Application.Dis playAlerts = True
End Sub
------------------------------**-----------------------------*-*-------

' Do Schedule D
'
Set qdDelXlsTbl = CurrentDb.Query Defs("schd_purg **e")
qdDelXlsTbl.Exe cute
Set qdGenXlsTbl =
CurrentDb.Query Defs("load_schd **_2004_Part1")
qdGenXlsTbl.Par ameters("prm_fu **nd_num") = sFundNum
qdGenXlsTbl.Exe cute
sXlsFilePath = sXlsPathRoot_D & "04d" & sFundNum & "a.xls"
DoCmd.TransferS preadsheet acExport, acSpreadsheetTy peExcel4,
"t_schd_export_ 2004", sXlsFilePath
Set xlsWorkBk = xlsApp.Workbook s.Open(sXlsFile **Path)
xlsWorkBk.Works heets(1).Column **s(1).Delete
xlsWorkBk.Works heets(1).Rows(1 **).Delete
<<<<I WOULD LIKE MACRO A TO RUN HERE>>>
xlsWorkBk.Save
xlsWorkBk.Close
Set qdDelXlsTbl = CurrentDb.Query Defs("schd_purg **e")
qdDelXlsTbl.Exe cute
Set qdGenXlsTbl =
CurrentDb.Query Defs("load_schd **_2004_Part2")
qdGenXlsTbl.Par ameters("prm_fu **nd_num") = sFundNum
qdGenXlsTbl.Exe cute
sXlsFilePath = sXlsPathRoot_D & "04d" & sFundNum & "b.xls"
DoCmd.TransferS preadsheet acExport, acSpreadsheetTy peExcel4,
"t_schd_export_ 2004", sXlsFilePath
Set xlsWorkBk = xlsApp.Workbook s.Open(sXlsFile **Path)
xlsWorkBk.Works heets(1).Rows(1 **).Delete
<<<<I WOULD LIKE MACRO B TO RUN HERE>>>
xlsWorkBk.Save
xlsWorkBk.Close
Any advice would be appreciated.

Nov 13 '05 #1
4 2227
I know almost nothing about automating Excel, but read this article....
http://www.mvps.org/access/modules/mdl0007.htm

Nov 13 '05 #2
I know almost nothing about automating Excel, but read this article....
http://www.mvps.org/access/modules/mdl0007.htm

Nov 13 '05 #3
Br
jp******@ibtco. com wrote:
I would like to add the xls macros below to the module listed. I am
looking for advice as to the best way to go about this.
<>
Any advice would be appreciated.


You'd need to reference Excel (in an Access module go to
Tools/References in the menu).
--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 13 '05 #4
Br
jp******@ibtco. com wrote:
I would like to add the xls macros below to the module listed. I am
looking for advice as to the best way to go about this.
<>
Any advice would be appreciated.


You'd need to reference Excel (in an Access module go to
Tools/References in the menu).
--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 13 '05 #5

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

Similar topics

4
1926
by: Steven | last post by:
I'm writing a Python script which can be called from the command-line, and I want to use my module doc string as the CL help text, but I don't know how to access my module object from inside the module. I've tried searching for an answer, but haven't found anything. Please excuse me if I'm missing something simple, I'm a newbie to Python. I'm doing something like this:
1
2594
by: Peter Åstrand | last post by:
There's a new PEP available: PEP 324: popen5 - New POSIX process module A copy is included below. Comments are appreciated. ---- PEP: 324 Title: popen5 - New POSIX process module
6
1708
by: Sean Berry | last post by:
I don't know that this partilarily bad programming, but I was interested in doing the following. def functionname( module, var1, var2 ): import module I would like to be able to pass the module name as an argument and have the module imported as a result. For instance... functionname( os, "1", 234)
3
1440
by: sean | last post by:
In article <cyH8c.3460$GH3.601@fed1read07>, sean@sands.beach.net (Sean Berry) writes: > I don't know that this partilarily bad programming, > but I was interested in doing the following. > > def functionname( module, var1, var2 ): > import module > > I would like to be able to pass the module name > as an argument and have the module imported as a result.
3
2272
by: Rob McCrea | last post by:
Hi all, On windows98SE, running Python 2.3.4 (#53, May 25 2004, 21:17:02) on win32, the built-in help() function gives me a deprecation warning when used on my docstrings. just help() start the interactive help without error. Heres some minimalistic code to demonstrate this warning: """start testhelp.py"""
4
1514
by: Lonnie Princehouse | last post by:
I've run into some eccentric behavior... It appears that one of my modules is being cut off at exactly 2^14 characters when I try to import it. Has anyone else encountered this? I can't find any mention of such a bug, and stranger yet, other modules that exceed 16384 characters seem to work just fine. In particular, suppose that my module foo.py contains the following as its last line: thing = "goodbye world"
2
1736
by: rh0dium | last post by:
Hi all, So I have a slice of code which calls other python code. I have started to take a real liking to the logging module, but I want to extend this into the called python code. I have no idea how to pass the handle from the calling code into the modules.. So basically here is what I do.. -- Main Program --
1
17210
by: alain MONTMORY | last post by:
Hello everybody, I am a newbie to python so I hope I am at the right place to expose my problem..... :-http://www.python.org/doc/2.4.2/ext/pure-embedding.html 5.3 Pure Embedding I download the code example from http://www.python.org/doc/2.4.2/ext/run-func.txt I call the file "TestOfficiel.c" and I compile it with : gcc -g -I/usr/include/python2.3/ TestOfficiel.c -o TestOfficiel -lpython2.3 -ldl all is OK (or seems to be...).
6
4021
by: JonathanOrlev | last post by:
Hello everyone, I have a newbe question: In Access (2003) VBA, what is the difference between a Module and a Class Module in the VBA development environment? If I remember correctly, new types of objects (classes) can only be defined in Class modules.
0
1228
by: Lie | last post by:
Yesterday I installed compiz-icon in my Ubuntu. Today, when I go to the python interpreter, I happen to do this: ### START OF PYTHON SESSION ### Python 2.5.2 (r252:60911, Apr 21 2008, 11:17:30) on linux2 Type "help", "copyright", "credits" or "license" for more information. Welcome to Python 2.5! This is the online help utility.
0
8105
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
8565
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...
1
8246
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8415
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...
1
6076
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
5532
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4109
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2550
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
1
1695
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.