如何使用Excel VBA自动化PeopleSoft?

如何使用Excel VBA自动化PeopleSoft?,excel,vba,peoplesoft,Excel,Vba,Peoplesoft,我有一个名单的人和他们的电子邮件在一个电子表格,我需要输入他们的电子邮件到他们的帐户上的人。有成千上万个这样的程序,所以我想让这个过程自动化 我从下面的代码开始,但是一直在 运行时错误 自动化误差 未明错误 Sub GoToWebSiteUpdate() Dim appIE As InternetExplorer Dim sURL As String Dim UserN As Variant Dim myLoginID As String Set appIE = New InternetExp

我有一个名单的人和他们的电子邮件在一个电子表格,我需要输入他们的电子邮件到他们的帐户上的人。有成千上万个这样的程序,所以我想让这个过程自动化

我从下面的代码开始,但是一直在

运行时错误
自动化误差 未明错误

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个)。然后可以在您选择的SQL工具中运行它们

2)正确的方法: 使用ExcelToCI。这是一个Excel上传工具,将运行所有页面验证等。我在这里写不出更多内容,但这是PeopleBooks中关于它的部分的链接:

问候


Duncan

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

代码将循环通过数据范围,即开始日期和结束日期,并生成摘录。因为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

PeopleSoft没有某种电子邮件/数据导入系统吗?我不知道你为什么需要VBA来做这个。您只需创建电子邮件数据并将其导入。它有一个导入系统,但是,我只需要修改系统中已经存在的电子邮件。不仅仅是导入表。这个方法会支持这样的东西吗?还是有其他的方法?我基本上只需要在表单中填写几个字段,然后单击“保存”,您需要导入一个更正电子邮件表。老实说,我不知道excel VBA会对你有什么帮助——假设你已经有了一份人们的电子邮件列表。您只需将数据导入PeopleSoft(通过导入)。