<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    夢幻之旅

    DEBUG - 天道酬勤

       :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
      671 隨筆 :: 6 文章 :: 256 評論 :: 0 Trackbacks
    '******************************************************************************
    '
    * File:     excel2pdm.txt
    '
    * Title:    pdm export to excel
    '
    * Purpose:  To export the tables and columns to Excel
    '
    * Model:    Physical Data Model
    '
    * Objects:  Table, Column, View
    '
    * Author:   ziyan
    '
    * Created:  2012-05-03
    '
    *Modifier:  Hui Wanpeng 2014/07/04
    '
    * Version:  1.0
    '
    ******************************************************************************
    Option Explicit

    Dim md1 'the current model
    Set md1=ActiveModel
    If(md1 Is NothingThen
      
    MsgBox "There is no Active Model"
    End If

    Dim HaveExcel
    Dim RQ
    RQ 
    = vbYes 'MsgBox("Is Excel Installed on your machine?",vbYesNo+vbInformation,"Confirmation")

    If RQ=vbYes Then
      HaveExcel
    =True
      
    'Open&Create Excel Document
      Dim x1
      
    set x1=CreateObject("Excel.Application")
      x1.Workbooks.Open 
    "E:/tmp/B超檢查表.xls"
      x1.Workbooks(
    1).Worksheets("Sheet1").Activate
    Else
      HaveExcel
    =False
    End If

    process x1, md1

    sub process(x1,md1)
        
    dim rwIndex
        
    dim tableName
        
    dim colname
        
    dim table
        
    dim col
        
    dim count
        
    dim dType
        
    dim nNull

        
    'on error Resume Next
        For rwIndex =1 To 500 step 1
           
    With x1.Workbooks(1).Worksheets("Sheet1")
              
    If .Cells(rwIndex,1).Value="" Then
                 
    Exit For
              
    End If
              
    If .Cells(rwIndex,3).Value="" Then
                  
    set table=md1.Tables.CreateNew
                  table.Name
    =.Cells(rwIndex,2).Value
                  table.Code
    =UCase(.Cells(rwIndex,1).Value)
                  table.Comment
    =.Cells(rwIndex,2).Value
                  count
    =count+1
              
    Else
                  colName
    =.Cells(rwIndex,1).Value
                  
    set col=table.Columns.CreateNew
                  
                  
    'MsgBox.Cells(rwIndex,1).Value
                   'MsgBox colName,vbOK+vbInformation,"列"
                  col.Code=Trim(UCase(.Cells(rwIndex,1).Value))
                  col.Name
    =Trim(UCase( .Cells(rwIndex,1).Value))
                  col.Comment
    =Trim(.Cells(rwIndex,2).Value)
               
                  dType
    =Trim(UCase(.Cells(rwIndex,3).Value))
                  
    'MsgBox Left(dType, 5)
                  If Left(dType, 5)="CHAR(" Then
                      dType
    =Replace(dType,"CHAR","VARCHAR2")
                  
    ElseIf Left(dType, 5)="CAHR(" Then 
                      dType
    =Replace(dType,"CAHR","VARCHAR2")
                  
    End If
                  col.DataType
    =dType
               
                  nNull
    =Trim(UCase(.Cells(rwIndex,4).Value))
                  
    If nNull="NOT NULL" then
                    col.Mandatory
    ="true"
                  
    End If
               
             
    End If
           
    End With
        
    Next

        
    MsgBox "生成數據表結構共計 " + CStr(count), vbOK+vbInformation, ""
        x1.Workbooks.Close
        
    Exit Sub

    End Sub


    posted on 2014-07-06 21:06 HUIKK 閱讀(390) 評論(0)  編輯  收藏 所屬分類: VB/VBA/VBS

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 色欲aⅴ亚洲情无码AV蜜桃| 在线亚洲午夜片AV大片| 国产福利在线观看永久免费| 最近的免费中文字幕视频| 2017亚洲男人天堂一| 99在线视频免费观看视频| 国产精品亚洲一区二区麻豆| 午夜免费福利影院| 国产精品亚洲天堂| 亚洲欧洲精品成人久久奇米网| 国产精品免费久久久久影院 | 久久国产乱子免费精品| 亚洲伊人久久大香线蕉苏妲己| 99re免费视频| 亚洲真人无码永久在线观看| 免费一级毛片在线播放| 久久精品免费网站网| 久久久久亚洲精品天堂| 无码免费午夜福利片在线| 无码一区二区三区亚洲人妻| 亚洲免费日韩无码系列| 一个人看的www免费视频在线观看 一个人免费视频观看在线www | 中文字幕版免费电影网站| 久久精品国产亚洲AV麻豆王友容| 一区二区三区观看免费中文视频在线播放 | 最近中文字幕无吗免费高清| 亚洲AV噜噜一区二区三区| 亚洲综合另类小说色区色噜噜| 免费av一区二区三区| 亚洲jizzjizz在线播放久| 国产大片51精品免费观看| 三上悠亚电影全集免费| 亚洲性69影院在线观看| 亚洲AV无码专区日韩| 84pao强力永久免费高清| 亚洲av无码一区二区三区天堂 | 桃子视频在线观看高清免费视频| 亚洲娇小性色xxxx| 亚洲一区二区三区自拍公司| 中文字幕无码视频手机免费看| 特级毛片aaaa免费观看|