求助attribute
我有一个.bas文件但是不知道如何在vb中使用,是把代码拷贝到vb中作为函数执行么?代码参见下面Attribute VB_Name = "Module1"
Const WINSYSTEM = False
Const TMPPATH = "c:\temp\convert\"
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub printhtml(htmlContent As String)
Send "Status: 200 OK"
Send "Content-type: text/html" & vbCrLf
Send "<HTML><HEAD><TITLE>Message from CGI</TITLE></HEAD>"
Send "<BODY>"
Send htmlContent
Send "</BODY></HTML>"
End Sub
Sub CGI_Main()
Dim upfile As String
Dim fullname As String
Dim htmname As String
upfile = GetCgiValue("uploaded_file")
'upfile = "file"
If Len(upfile) Then
If WINSYSTEM Then
Sleep 10000
End If
Dim WordApp As New Word.Application
fullname = TMPPATH & upfile & ".doc"
htmname = TMPPATH & upfile & ".htm"
WordApp.Visible = True
WordApp.DisplayAlerts = wdAlertsNone
WordApp.Documents.Open fullname
'adjust the format
With WordApp
With .ActiveDocument.WebOptions
.Encoding = 65001
.RelyOnCSS = True
.OptimizeForBrowser = True
.BrowserLevel = 0
.OrganizeInFolder = True
.UseLongFileNames = True
.RelyOnVML = False
.AllowPNG = False
.ScreenSize = msoScreenSize800x600
.PixelsPerInch = 96
End With
'ActiveDocument.WebOptions.
.ActiveDocument.SaveAs htmname, 10
.ActiveDocument.Close
End With
WordApp.Quit SaveChanges:=wdDoNotSaveChanges
If WINSYSTEM Then
Sleep 10000
End If
printhtml ("Success")
Else
printhtml ("No file uploaded")
End If
End Sub