标题:求助attribute
取消只看楼主
hn2002
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2008-9-1
 问题点数:0 回复次数:0 
求助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
搜索更多相关主题的帖子: attribute 
2008-09-02 14:19



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-230994-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.348179 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved