SharePoint 2010将隐藏字符添加到Excel导出

SharePoint 2010将隐藏字符添加到Excel导出,excel,sharepoint,export,powerpoint,vba,Excel,Sharepoint,Export,Powerpoint,Vba,我正在将SharePoint文档导出到Excel。在我运行VBA宏将Excel数据移动到PowerPoint文本框之前,一切看起来都很好。(我们无法编写自定义代码来绕过步骤中的Excel。) 对于作为富文本框的SharePoint字段(在创建文档的InfoPath表单中定义),将在第一个字符位置放置问号 我在Excel中检查了一个问号,但它无法识别。我相信问号可能是一个符号,而不是一个真正的问号。有人遇到过这个问题吗?如果有,你是如何解决的 我不能简单地删掉第一个字符,因为有时问号不会出现 谢谢

我正在将SharePoint文档导出到Excel。在我运行VBA宏将Excel数据移动到PowerPoint文本框之前,一切看起来都很好。(我们无法编写自定义代码来绕过步骤中的Excel。)

对于作为富文本框的SharePoint字段(在创建文档的InfoPath表单中定义),将在第一个字符位置放置问号

我在Excel中检查了一个问号,但它无法识别。我相信问号可能是一个符号,而不是一个真正的问号。有人遇到过这个问题吗?如果有,你是如何解决的

我不能简单地删掉第一个字符,因为有时问号不会出现

谢谢

这是宏代码

Sub valppt()
Dim PPT As PowerPoint.Application
Dim newslide As PowerPoint.SlideRange
Dim slideCtr As Integer
Dim textCtr As Integer
Dim CompRange As Integer
Dim n As Integer
Dim CompRange2 As String
Dim tempString As String
Dim tempString2 As String
Dim hidChar As String
Dim tb As PowerPoint.Shape


Range("AC2:AC10000").Select
Selection.Replace What:="D", Replacement:="2", LookAt:=xlPart, _
    SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
    ReplaceFormat:=False
Selection.Replace What:="N", Replacement:="1", LookAt:=xlPart, _
    SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
    ReplaceFormat:=False
Selection.Replace What:="S", Replacement:="3", LookAt:=xlPart, _
    SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
    ReplaceFormat:=False


ActiveWorkbook.Worksheets("owssvr").ListObjects("Table_owssvr").Sort.SortFields _
    .Clear
ActiveWorkbook.Worksheets("owssvr").ListObjects("Table_owssvr").Sort.SortFields _
    .Add Key:=Range("Table_owssvr[Status]"), SortOn:=xlSortOnValues, Order:= _
    xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("owssvr").ListObjects("Table_owssvr").Sort
    .Header = xlYes
    .MatchCase = False
    .Orientation = xlTopToBottom
    .SortMethod = xlPinYin
    .Apply
End With

Range("AC2:AC10000").Select
Selection.Replace What:="2", Replacement:="D", LookAt:=xlPart, _
    SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
    ReplaceFormat:=False
Selection.Replace What:="1", Replacement:="N", LookAt:=xlPart, _
    SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
    ReplaceFormat:=False
Selection.Replace What:="3", Replacement:="S", LookAt:=xlPart, _
    SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
    ReplaceFormat:=False

Cells.Select
Selection.RowHeight = 60
With Selection.Font
    .Name = "Arial"
    .FontStyle = "Regular"
    .Size = 9
    .Strikethrough = False
    .Superscript = False
    .Subscript = False
    .OutlineFont = False
    .Shadow = False
    .TintAndShade = 0
    .ThemeFont = xlThemeFontNone
End With

Set PPT = CreateObject("PowerPoint.Application")
PPT.Visible = True

PPT.Presentations.Open ("C:\Documents\RegularMaster.pptm")

Range("F2").Activate
slideCtr = 1
textCtr = 1

Set newslide = PPT.ActivePresentation.Slides(slideCtr).Duplicate


slideCtr = slideCtr + 1
hidChar = "?"
' Do Until ActiveCell.Value = ""
Do Until textCtr = 0
    Do Until textCtr > 14
        Set tb = newslide.Shapes("TextBox" & textCtr)
        'tb.TextFrame.TextRange.Characters.Text = Format(ActiveCell.Value, "m/d/yyyy")
        tb.OLEFormat.Object.Value = Format(ActiveCell.Value, "m/d/yyyy")
        textCtr = textCtr + 1
        ActiveCell.Offset(0, 1).Activate

    Loop

    textCtr = 15

    Do Until textCtr > 21

        tempString = ""
        tempString2 = Left(ActiveCell.Value, 1)
        If ActiveCell.Value <> "" Then
            If tempString2 Like "[A-Z,a-z,0-9]" Then
                tempString = ActiveCell.Value
            Else
                tempString = Right(ActiveCell.Value, Len(ActiveCell.Value) - 1)
            End If
        End If

        Set tb = newslide.Shapes("TextBox" & textCtr)
        tb.OLEFormat.Object.Value = tempString

        textCtr = textCtr + 1
        ActiveCell.Offset(0, 1).Activate
        tempString2 = ""

    Loop

    textCtr = 22

    Do Until textCtr > 26

        Set tb = newslide.Shapes("TextBox" & textCtr)
        tb.OLEFormat.Object.Value = ActiveCell.Value
        textCtr = textCtr + 1
        ActiveCell.Offset(0, 1).Activate


    Loop

    textCtr = 27
    ActiveCell.Offset(0, 3).Activate
    Do Until textCtr > 29
        tempString = ""
        tempString2 = Left(ActiveCell.Value, 1)

        If ActiveCell.Value <> "" Then
            If tempString2 Like "[A-Z,a-z,0-9]" Then
                tempString = ActiveCell.Value
            Else
                tempString = Right(ActiveCell.Value, Len(ActiveCell.Value) - 1)
            End If
        End If
        Set tb = newslide.Shapes("TextBox" & textCtr)
        tb.OLEFormat.Object.Value = tempString

        textCtr = textCtr + 1
        ActiveCell.Offset(0, 1).Activate
        tempString2 = ""
    Loop

    textCtr = 1
    CompRange = Split(ActiveCell.Address, "$")(2)
    CompRange2 = "B" & CompRange
    Range(CompRange2).Activate
    Do Until textCtr > 7
        If UCase(ActiveCell.Value) = "TRUE" Then
            Set tb = newslide.Shapes("CheckBox" & textCtr)
            tb.OLEFormat.Object.Value = UCase(ActiveCell.Value)
        End If
        textCtr = textCtr + 1
        If textCtr < 8 Then
            If textCtr = 2 Then
                CompRange2 = "AO" & CompRange
            ElseIf textCtr = 3 Then
                CompRange2 = "AG" & CompRange
            ElseIf textCtr = 4 Then
                CompRange2 = "AF" & CompRange
            ElseIf textCtr = 5 Then
                CompRange2 = "AH" & CompRange
            ElseIf textCtr = 6 Then
                CompRange2 = "AN" & CompRange
            Else
                CompRange2 = "AP" & CompRange
            End If
        End If

        Range(CompRange2).Activate


    Loop

    CompRange = Split(ActiveCell.Address, "$")(2)

    Application.Goto Range("A" & CompRange), True
    ActiveCell.Offset(1, 0).Activate
    If ActiveCell.Value = "" Then
      textCtr = 0
    Else

      Set newslide = PPT.ActivePresentation.Slides(1).Duplicate
      textCtr = 1
      ActiveCell.Offset(0, 5).Activate
    End If

Loop



End Sub
Sub-valppt()
将PPT变暗为PowerPoint.Application
将新闻幻灯片变暗为PowerPoint.SlideRange
作为整数的Dim滑块
作为整数的Dim textCtr
Dim压缩为整数
作为整数的Dim n
Dim COMPANGE2作为字符串
将字符串设置为字符串
将tempString2设置为字符串
Dim hidChar作为字符串
将tb设置为PowerPoint.Shape
范围(“AC2:AC10000”)。选择
选择。替换内容:=“D”,替换:=“2”,查看:=xlPart_
SearchOrder:=xlByRows,MatchCase:=False,SearchFormat:=False_
ReplaceFormat:=False
选择。替换内容:=“N”,替换:=“1”,查看:=xlPart_
SearchOrder:=xlByRows,MatchCase:=False,SearchFormat:=False_
ReplaceFormat:=False
选择。替换内容:=“S”,替换:=“3”,查看:=xlPart_
SearchOrder:=xlByRows,MatchCase:=False,SearchFormat:=False_
ReplaceFormat:=False
ActiveWorkbook.Worksheets(“owsvr”).ListObjects(“Table_owsvr”).Sort.SortFields_
清楚的
ActiveWorkbook.Worksheets(“owsvr”).ListObjects(“Table_owsvr”).Sort.SortFields_
.Add Key:=Range(“Table_owssvr[Status]”),SortOn:=xlSortOnValues,Order:=_
xlAscending,DataOption:=xlSortNormal
使用ActiveWorkbook.Worksheets(“owsvr”).ListObjects(“Table_owsvr”).Sort
.Header=xlYes
.MatchCase=False
.方向=xlTopToBottom
.SortMethod=xl拼音
.申请
以
范围(“AC2:AC10000”)。选择
选择。替换内容:=“2”,替换:=“D”,查看:=xlPart_
SearchOrder:=xlByRows,MatchCase:=False,SearchFormat:=False_
ReplaceFormat:=False
选择。替换内容:=“1”,替换:=“N”,查看:=xlPart_
SearchOrder:=xlByRows,MatchCase:=False,SearchFormat:=False_
ReplaceFormat:=False
选择。替换内容:=“3”,替换:=“S”,查看:=xlPart_
SearchOrder:=xlByRows,MatchCase:=False,SearchFormat:=False_
ReplaceFormat:=False
单元格。选择
Selection.RowHeight=60
使用Selection.Font
.Name=“Arial”
.FontStyle=“常规”
.尺寸=9
.Strikethrough=False
.Superscript=False
.Subscript=False
.OutlineFont=False
.Shadow=False
.TintAndShade=0
.ThemeFont=xlThemeFontNone
以
设置PPT=CreateObject(“PowerPoint.Application”)
PPT.Visible=True
PPT.Presentations.Open(“C:\Documents\RegularMaster.pptm”)
范围(“F2”)。激活
slideCtr=1
textCtr=1
Set newslide=PPT.ActivePresentation.Slides(slideCtr)。重复
slideCtr=slideCtr+1
hidChar=“?”
'直到ActiveCell.Value=“”
直到textCtr=0为止
直到textCtr>14为止
Set tb=newslide.Shapes(“TextBox”和textCtr)
'tb.TextFrame.TextRange.Characters.Text=格式(ActiveCell.Value,“m/d/yyyy”)
tb.OLEFormat.Object.Value=格式(ActiveCell.Value,“m/d/yyyy”)
textCtr=textCtr+1
ActiveCell.Offset(0,1).激活
环
textCtr=15
直到textCtr>21为止
tempString=“”
tempString2=Left(ActiveCell.Value,1)
如果ActiveCell.Value为“”,则
如果tempString2像“[A-Z,A-Z,0-9]”,那么
tempString=ActiveCell.Value
其他的
tempString=Right(ActiveCell.Value,Len(ActiveCell.Value)-1)
如果结束
如果结束
Set tb=newslide.Shapes(“TextBox”和textCtr)
tb.OLEFormat.Object.Value=tempString
textCtr=textCtr+1
ActiveCell.Offset(0,1).激活
tempString2=“”
环
textCtr=22
直到textCtr>26为止
Set tb=newslide.Shapes(“TextBox”和textCtr)
tb.OLEFormat.Object.Value=ActiveCell.Value
textCtr=textCtr+1
ActiveCell.Offset(0,1).激活
环
textCtr=27
ActiveCell.Offset(0,3).激活
直到textCtr>29为止
tempString=“”
tempString2=Left(ActiveCell.Value,1)
如果ActiveCell.Value为“”,则
如果tempString2像“[A-Z,A-Z,0-9]”,那么
tempString=ActiveCell.Value
其他的
tempString=Right(ActiveCell.Value,Len(ActiveCell.Value)-1)
如果结束
如果结束
Set tb=newslide.Shapes(“TextBox”和textCtr)
tb.OLEFormat.Object.Value=tempString
textCtr=textCtr+1
ActiveCell.Offset(0,1).激活
tempString2=“”
环
textCtr=1
CompRange=Split(ActiveCell.Address,“$”)(2)
CompRange2=“B”&CompRange
范围(压缩2)。激活
直到textCtr>7为止
如果UCase(ActiveCell.Value)=“TRUE”,则
设置tb=newslide.Shapes(“复选框”&textCtr)
tb.OLEFormat.Object.Value=UCase(ActiveCell.Value)
如果结束
textCtr=textCtr+1
如果textCtr<8,则
如果textCtr=2,则
CompRange2=“AO”&CompRange
ElseIf textCtr=3然后
CompRange2=“AG”&CompRange
ElseIf textCtr=4然后
CompRange2=“AF”&CompRange
ElseIf textCtr=5,则
CompRange2=“AH”&CompRange
ElseIf textCtr=6,则
CompRange2=“AN”&CompRange
其他的
CompRange2=“AP”&CompRange
如果结束
如果结束
范围(压缩2)。激活
厕所
Do Until textCtr > 21    
        tempString = ""
        tempString2 = Left(ActiveCell.Value, 1)
        If ActiveCell.Value <> "" Then
            If tempString2 Like "[A-Z,a-z,0-9]" Then
                tempString = ActiveCell.Value
            Else
                tempString = Right(ActiveCell.Value, Len(ActiveCell.Value) - 1)
            End If
        End If

        Set tb = newslide.Shapes("TextBox" & textCtr)
        tb.OLEFormat.Object.Value = tempString

        textCtr = textCtr + 1
        ActiveCell.Offset(0, 1).Activate
        tempString2 = ""

    Loop