🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.vbasic
Article #104726

automatyzacja Accessa z poziomu VB.NET

#104726
From: Maciej Franciszkowski
Date: Fri, 10 Dec 2010 10:44
76 lines
3353 bytes
witam

próbuję wysłąć raport przez automatyzację
doszedłem do komunikatu że nie można wywołać Active-X


poniżej jest kod, który modyfikuję. Tak naprawdę wcale nie chciabym
aplikacji
Accessowej wywoływać, tylko wysłać z niej raport emailem.


            Private Declare Sub Sleep Lib "Kernel32" (ByVal dwMS As
Long)
            Private Sub accAuth()
                Dim accObj As Object, Msg As String
                Dim application As String, dbs As String, workgroup
As
String
                Dim user As String, password As String, cTries As
Integer
                Dim x


                ' This is the default location of Access
                application = "C:\Program Files\Microsoft Office
\Office11\MSACCESS.EXE"
                ' Use the path and name of a secured MDB on your
system
                dbs = "C:\Plan\Baza.mdb"
                ' This is the default workgroup
                workgroup = "C:\Plan\System.mdw "
                user = "user"           ' Use a valid username
                password = "pass"  ' and correct password


                x = Shell(application & " " & Chr(34) & dbs & Chr(34)
& " /nostartup /user " & user & _
                " /pwd " & password & " /wrkgrp " & Chr(34) &
workgroup & Chr(34), vbMinimizedFocus)


                'On Error GoTo WAITFORACCESS
                accObj = GetObject(, "Access.Application")


                ' Turn off error handling
                On Error GoTo 0


                ' You can now use the accObj reference to automate
Access


                Msg = "Access is now open. You can click on Microsoft
Access "
                Msg = Msg & "in the Taskbar to see that your database
is open."
                Msg = Msg & vbCrLf & vbCrLf & "When ready, click OK
to
close."
                Console.WriteLine(Msg)


                accObj.CloseCurrentDatabase()
                accObj.Quit()


                accObj = Nothing
                Console.WriteLine("All Done!")


                'Exit Sub


Z góry dziękuję za podpowiedzi
MF
Technical Details
Message-ID: <8a59ab7b-d7f4-493e-8ea6-075e41cb5a69@w18g2000vbe.googlegroups.com>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.glorb.com!news2.glorb.com!postnews.google.com!w18g2000vbe.googlegroups.com!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.glorb.com!news2.glorb.com!postnews.google.com!w18g2000vbe.googlegroups.com!not-for-mail
From: Maciej Franciszkowski <maciejfr@poczta.onet.pl>
Newsgroups: pl.comp.lang.vbasic
Subject: automatyzacja Accessa z poziomu VB.NET
Date: Fri, 10 Dec 2010 02:44:24 -0800 (PST)
Organization: http://groups.google.com
Lines: 79
Message-ID: <8a59ab7b-d7f4-493e-8ea6-075e41cb5a69@w18g2000vbe.googlegroups.com>
NNTP-Posting-Host: 83.18.239.123
Mime-Version: 1.0
X-Trace: posting.google.com 1291977864 21107 127.0.0.1 (10 Dec 2010 10:44:24 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Fri, 10 Dec 2010 10:44:24 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: w18g2000vbe.googlegroups.com; posting-host=83.18.239.123; posting-account=kc7ZIQoAAAB5PkdJgxjq1dd8jnBK4MVp
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; OfficeLiveConnector.1.4; OfficeLivePatch.1.3),gzip(gfe)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit