2013-11-28 31 views
1

這是我的代碼。調試器指出第二個子問題,問題在哪裏。我希望用兩個不同的pre_word將文檔保存爲pdf。謝謝。從另一個子設備調用子設備時出現「預期的功能或變量」錯誤

Sub yeniDosyaAdiVer() 
    yeniDosyaAdiKelimeleri = Split(ActiveDocument.FullName, ".") 
    yeniDosyaAdiKelimeleriSayisi = UBound(yeniDosyaAdiKelimeleri) 
    'MsgBox ("Kelime sayısı:" & yeniDosyaAdiKelimeleriSayisi) 
    For xcv = 0 To (yeniDosyaAdiKelimeleriSayisi - 1) 
    'MsgBox (xcv & ". kelime:" & yeniDosyaAdiKelimeleri(xcv)) 
     sonDosyaAdi = sonDosyaAdi & yeniDosyaAdiKelimeleri(xcv) & "." 
    'MsgBox (sonDosyaAdi) 
    yeniDosyaAdiVer = sonDosyaAdi 
End Sub 

Sub TİTCK2pdf() 
    With ActiveDocument 
     .ExportAsFixedFormat OutputFileName:="titck-imza-" & yeniDosyaAdiVer() & "pdf", _ 
     ExportFormat:=wdExportFormatPDF, OpenAfterExport:=False, _ 
     OptimizeFor:=wdExportOptimizeForPrint, Range:=wdExportAllDocument, _ 
     Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _ 
     CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _ 
     BitmapMissingFonts:=True, UseISO19005_1:=False 
    End With 
End Sub 

Sub TİTCK_ic2pdf() 

With ActiveDocument 
    .ExportAsFixedFormat OutputFileName:="titck-imza-ic-" & yeniDosyaAdiVer() & "pdf", _ 
    ExportFormat:=wdExportFormatPDF, OpenAfterExport:=False, _ 
    OptimizeFor:=wdExportOptimizeForPrint, Range:=wdExportAllDocument, _ 
    Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _ 
    CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _ 
    BitmapMissingFonts:=True, UseISO19005_1:=False 
End With 


End Sub 

回答

1

yeniDosyaAdiVer()是一個子。它不返回任何結果......在TITCK的第二行,你要那麼你需要改變子到功能

Function yeniDosyaAdiVer() 
    yeniDosyaAdiKelimeleri = Split(ActiveDocument.FullName, ".") 
    yeniDosyaAdiKelimeleriSayisi = UBound(yeniDosyaAdiKelimeleri) 
    'MsgBox ("Kelime sayısı:" & yeniDosyaAdiKelimeleriSayisi) 
    For xcv = 0 To (yeniDosyaAdiKelimeleriSayisi - 1) 
    'MsgBox (xcv & ". kelime:" & yeniDosyaAdiKelimeleri(xcv)) 
     sonDosyaAdi = sonDosyaAdi & yeniDosyaAdiKelimeleri(xcv) & "." 
    'MsgBox (sonDosyaAdi) 
    yeniDosyaAdiVer = sonDosyaAdi 
End Function 

Sub TİTCK2pdf() 
    With ActiveDocument 
     .ExportAsFixedFormat OutputFileName:="titck-imza-" & yeniDosyaAdiVer & "pdf", _ 
     ExportFormat:=wdExportFormatPDF, OpenAfterExport:=False, _ 
     OptimizeFor:=wdExportOptimizeForPrint, Range:=wdExportAllDocument, _ 
     Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _ 
     CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _ 
     BitmapMissingFonts:=True, UseISO19005_1:=False 
    End With 
End Sub 

Sub TİTCK_ic2pdf() 

With ActiveDocument 
    .ExportAsFixedFormat OutputFileName:="titck-imza-ic-" & yeniDosyaAdiVer & "pdf", _ 
    ExportFormat:=wdExportFormatPDF, OpenAfterExport:=False, _ 
    OptimizeFor:=wdExportOptimizeForPrint, Range:=wdExportAllDocument, _ 
    Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _ 
    CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _ 
    BitmapMissingFonts:=True, UseISO19005_1:=False 
End With 


End Sub 
+0

它現在要插入值,但這個時候犯錯消息變爲不是有效的文件名。文件名包括「 - 」字符。它是保留字符嗎? – caglaror

+0

我想你可能在pdf之前錯過了一個點,或者因爲你已經以PDF格式導出,可能根本不需要.pdf。只是玩它 – 2013-11-28 11:14:39

+1

你是對的。我找到了。非常感謝你。 ;) – caglaror

相關問題