我如何使用Excel VBA自动化PeopleSoft?

我有一个电子表格中的人员和他们的电子邮件列表,我需要input他们的电子邮件到People Soft V8上的帐户。 有成千上万,所以我正在寻求自动化这个过程。

我已经开始使用下面的代码,但一直在得到

运行时错误
自动化错误未指定的错误

Sub GoToWebSiteUpdate() Dim appIE As InternetExplorer Dim sURL As String Dim UserN As Variant Dim myLoginID As String Set appIE = New InternetExplorer sURL = "Webaddress" appIE.navigate sURL appIE.Visible = True 'Enter information in the first drop down Set UserN = appIE.document.getElementsById("InputBox") UserN(0).Value = "012354" Set appIE = Nothing End Sub 

如果有人有任何想法,将是伟大的,谢谢。

有几个非常简单的方法来做到这一点。

1)快速和肮脏的方法:使用Excel公式(在每行的最后一个单元格中)将值连接在一起成为一条SQL语句(每行1)。 然后,您可以在您select的SQL工具中运行它们。

2)“正确的”方法:使用ExcelToCI。 这是一个Excel上传工具,它将运行所有的页面validation等。除了我可以在这里写的东西,还有更多的东西,但是这是PeopleBooks中它的部分的链接: http : //docs.oracle.com/cd/ E28394_01 / pt852pbh1 /英/ psbooks / TCPI / book.htm?文件= TCPI / HTM / tcpi10.htm#H3002

亲切的问候

邓肯

我使用实际的工作代码从peoplesoft提取报告。 代码是通过在互联网上查找各种博客和代码库编写的

代码将循环通过数据范围,即开始date和结束date,并生成提取。 由于Psoft不能提供超过65K行的提取,我一次只能运行7天。

 Public Declare PtrSafe Function SetForegroundWindow Lib "user32" (ByVal HWND As Long) As Long Sub PPS_Report_Extractor() Dim Cell, Rng As Range 'Declaring cell for looping thru date range 'Dim appIE As Object 'InternetExplorer.Application Dim appIE As InternetExplorer Dim sURL As String 'URL String Dim Element As Object 'HTMLButtonElement Dim btnInput As Object 'MSHTML.HTMLInputElement Dim ElementCol As Object 'MSHTML.IHTMLElementCollection Dim Link As Object 'MSHTML.HTMLAnchorElement Dim Counter, myNum 'Add Counter Counter = 0 'Declare Start for Counter myNum = 147 'Declare the number of repitition required RemNamedRanges 'Delete the older ranges '---Set New Range of reporting start dates ----- Range("A1").Offset(1, 0).Select Range(Selection, Selection.End(xlDown)).Select Selection.Name = "ElementCol" Set Rng = Worksheets("Sheet1").Range("Elementcol") '---Launch the IE ----- ' Set appIE = CreateObject("InternetExplorer.Application") Set appIE = New InternetExplorerMedium sURL = "" ' open the URL by loggin intot PPS query then past that url here appIE.Navigate sURL appIE.Visible = True 'While appIE.Busy ' DoEvents 'Wend Pause (5) 'Allow IE to load SendKeys "{ENTER}" 'Hit log on button in IE '-Loop to generate the Files for full year starts here --- For Each Cell In Rng A = Format(Cell.Value, "DD-MM-YYYY") B = Format(Cell.Offset(0, 1).Value, "DD-MM-YYYY") '----Code for extraction ---START--- Application.Wait Now + TimeValue("00:00:5") 'Pause (5) 'Allow IE to load appIE.Document.getelementbyid("InputKeys_bind2").Value = A appIE.Document.getelementbyid("InputKeys_bind3").Value = B appIE.Document.getelementbyid("#ICQryDownloadExcelFrmPrompt").Click Pause (5) SendKeys "{ENTER}", 5 '---Wait for excel generation to complete I = 0 Set fo = CreateObject("Scripting.FileSystemObject") Do Until fo.FileExists(OutFile) 'Loop until the output file is created, this could be infinity if there is a problem Application.Wait (Now + TimeValue("0:00:2")) 'Holds the program for 2 seconds DoEvents I = I + 1 If (I = 10) Then SendKeys "%S" 'Alt S to save the report GoTo 1 End If Loop 1 '----Code for extraction ---END--- Next Cell '-Loop to generate the Files for full year Ends here here --- MsgBox "The range has " & K & " rows." End Sub