我试图弄清楚如何将 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 上的多个文档相互通信并完全避免网络共享?请尽快提出建议。
非常感谢你。