1

我试图弄清楚如何将 Excel 电子表格从映射驱动器移动到 SharePoint。

我们有一个工程部门使用此电子表格来保存工作和工作编号的活动列表。

它像这样分解:

用户打开 Job Tracking 电子表格并输入信息 在最后一个选项卡上,有一个红色按钮可转到另一个 Excel 工作簿,该工作簿提供下一个可用的工作编号,并在红色按钮所在的 Job Tracking 电子表格中生成。

单击红色按钮时运行的代码:

Private Sub CommandButton1_Click()
    Dim JTS As String
    Dim yRow, UseRow
    Dim Msg, Style, Title, Help, Ctxt, Response, Msg1, Msg2, Msg3

    UnProtect_Files

    If Worksheets("HANDOVER").Range("Job_No") <> "" Then GoTo JobFill1
    If Len(Worksheets("HANDOVER").Range("C4")) < 1 Then GoTo WhereCust1

    JTS = "P:\Job Tracking\Job Tracking Spreadsheet.xls"

    On Error GoTo Lock1

    OpBkNow:
    Workbooks.Open (JTS)

    'Look for available Job# in Job Tracking Spreadsheet

    For yRow = 23 To 10000
    If Workbooks("Job Tracking Spreadsheet.xls").Worksheets("Proposed-Active").Cells(yRow, 2) = "" Then UseRow = yRow: Exit For Next yRow
    'This should never happen, but if there is no available Job#, print msg and exit sub
    If UseRow < 23 Or UseRow > 10000 Then GoTo RowNtFnd


    'Make changes to Job Tracking Spreadsheet
    ThisWorkbook.Worksheets("Formulas").Range("B98") = Workbooks("Job Tracking Spreadsheet.xls").Worksheets("Proposed-Active").Cells(UseRow, 1)
    Workbooks("Job Tracking Spreadsheet.xls").Worksheets("Proposed-Active").Cells(UseRow, 2) = ThisWorkbook.Worksheets("HANDOVER").Range("C4")
    ThisWorkbook.Worksheets("HANDOVER").Range("Job_No") = ThisWorkbook.Worksheets("Formulas").Range("B98")
    Workbooks("Job Tracking Spreadsheet.xls").Worksheets("Proposed-Active").Cells(UseRow, 3) = ThisWorkbook.Worksheets("HANDOVER").Range("D7")

    GoTo QuitSb2

    RowNtFnd:
    Msg = "There are no available Job Numbers in the Job Tracking Spreadsheet.  You will need to manually add one."
    Style = vbOKOnly: Title = "Job Number Not Found": Help = "": Ctxt = 0
    Response = MsgBox(Msg, Style, Title, Help, Ctxt)

    QuitSb2:
    Workbooks("Job Tracking Spreadsheet.xls").Close SaveChanges:=True
    GoTo QuitSb1

    WhereCust1:
    'No Owner Name Given
    Msg = "An entry in the CUSTOMER field is required when generating a Job Number!"
    Style = vbOKOnly: Title = "Need Customer Info - Try Again": Help = "": Ctxt = 0
    Response = MsgBox(Msg, Style, Title, Help, Ctxt)
    GoTo QuitSb1

    JobFill1:
    'There is already a generated job number
    Msg1 = "A Job Number ("
    Msg2 = Worksheets("HANDOVER").Range("Job_No")
    Msg3 = ") has already been generated for this job!"

    Msg = Msg1 & Msg2 & Msg3
    Style = vbOKOnly: Title = "Job Number Exists": Help = "": Ctxt = 0
    Response = MsgBox(Msg, Style, Title, Help, Ctxt)
    GoTo QuitSb1

    Lock1:
    'There is already a generated job number
    Msg1 = "The Job Tracking spreadsheet is currently in use.  "
    Msg2 = "Please try to generate a Job Number later."
    Msg = Msg1 & Msg2
    Style = vbOKOnly: Title = "File In Use": Help = "": Ctxt = 0
    Response = MsgBox(Msg, Style, Title, Help, Ctxt)
    GoTo QuitSb1

    QuitSb1:

    'RER 3-29-05 remove auto file create as per Scott Penatzer request
    'Create_New_File

    Protect_Files
End Sub

以另一种方式来做这一切可能更容易,但最终企业宁愿我什么也不做。是否可以让 SharePoint 上的多个文档相互通信并完全避免网络共享?请尽快提出建议。

非常感谢你。

4

1 回答 1

0

是的,您可以让文件通过 SharePoint 进行通信。转到 SharePoint 中的库,单击功能区中的“在资源管理器中打开”。这将为您提供文件的文件夹位置。您应该能够像映射驱动器位置一样引用该 URL,并打开/更新/保存 SharePoint 文件。祝你好运。

于 2013-05-14T14:33:26.883 回答