메인 컨텐츠로 가기

시트에 모든 Excel 파일의 속성을 나열하는 방법은 무엇입니까?

이 기사에서는 시트에있는 활성 통합 문서의 모든 속성을 나열하는 VBA 코드를 소개합니다.

1. 프레스 Alt + F11 키를 눌러 Microsoft Visual Basic for Applications 창을 활성화합니다.

2. 클릭 끼워 넣다 > 모듈을 클릭하고 아래 코드를 빈 모듈에 붙여 넣습니다.

VBA : 모든 속성 나열

Sub WBProperties()
'UpdatebyKutools20191031
    Dim xWB As Workbook
    Dim xF As Long
    Dim xStr As String
    Dim xWSh As Worksheet
    On Error Resume Next
    Application.DisplayAlerts = False
    xStr = "Workbook Properties"
    Set xWB = Application.ActiveWorkbook
    Set xWSh = xWB.Worksheets.Item(xStr)
    If Not xWSh Is Nothing Then
        xWSh.Delete
    End If
    Set xWSh = xWB.Worksheets.Add
    xWSh.Name = xStr
    xWSh.Range("A1").Value = "Property"
    xWSh.Range("B1").Value = "Value"
    With xWB
        For xF = 1 To .BuiltinDocumentProperties.Count
            xWSh.Range("A65536").End(xlUp).Offset(1, 0).Value = _
            .BuiltinDocumentProperties.Item(xF).Name
            xWSh.Range("A65536").End(xlUp).Offset(0, 1).Value = _
            .BuiltinDocumentProperties.Item(xF).Value
        Next xF
    End With
    Application.DisplayAlerts = True
End Sub

문서 목록 모두 추가 1

3. 프레스 F5 키를 눌러 코드를 실행하면 활성 통합 문서의 모든 속성을 나열하는 통합 문서 속성이라는 새 시트가 활성 시트 앞에 생성되었습니다.
문서 목록 모두 추가 1


기타 작업 (문서)

Excel 시작시 추가 기능 비활성화
Microsoft Excel에 일부 추가 기능을 설치했을 수 있지만 이제 Excel을 시작할 때 지정된 추가 기능을 비활성화해야합니다. 이 문제를 해결하는 방법? 이 기사의 방법이 도움이 될 수 있습니다.

Excel에서 각 워크 시트를 별도의 새 통합 문서로 내보내기 및 저장
하나 또는 여러 워크 시트를 새 통합 문서로 내보내고 저장하려고한다고 가정 해 보겠습니다. 어떻게 처리 하시겠습니까? 일반적으로 각 워크 시트를 복사하여 새 워크 북에 붙여 넣을 수 있습니다. 그러나 여기서 우리는 그것을 다루는 몇 가지 유용한 트릭을 제공합니다.

Excel의 모든 추가 기능을 나열하는 VBA 코드
Excel에서는 데이터를 더 잘 처리하기 위해 추가 기능을 추가하거나 삽입 할 수 있습니다. 아시다시피 옵션 창으로 이동하여 모든 추가 기능을 볼 수 있지만 시트의 모든 추가 기능을 나열하는 방법이 있습니까?


  • 슈퍼 포뮬러 바 (여러 줄의 텍스트와 수식을 쉽게 편집 할 수 있습니다.) 레이아웃 읽기 (많은 수의 셀을 쉽게 읽고 편집합니다.) 필터링 된 범위에 붙여 넣기...
  • 셀 / 행 / 열 병합 및 데이터 보관; 셀 내용 분할; 중복 행과 합계 / 평균 결합... 중복 셀 방지; 범위 비교...
  • 중복 또는 고유 선택 행; 빈 행 선택 (모든 셀이 비어 있음); 슈퍼 찾기 및 퍼지 찾기 많은 통합 문서에서; 무작위 선택 ...
  • 정확한 사본 수식 참조를 변경하지 않고 여러 셀; 참조 자동 생성 여러 시트에; 글 머리 기호 삽입, 확인란 등 ...
  • 즐겨 찾기 및 빠른 수식 삽입, 범위, 차트 및 그림; 셀 암호화 암호로; 메일 링리스트 생성 이메일 보내기 ...
  • 텍스트 추출, 텍스트 추가, 위치 별 제거, 공간 제거; 페이징 부분합을 만들고 인쇄합니다. 셀 내용과 주석 간 변환...
  • 슈퍼 필터 (다른 시트에 필터 구성표 저장 및 적용) 고급 정렬 월 / 주 / 일, 빈도 등 특수 필터 굵은 기울임 꼴로 ...
  • 통합 문서와 워크 시트 결합; 키 열을 기반으로 테이블 병합; 데이터를 여러 시트로 분할; xls, xlsx 및 PDF 일괄 변환...
  • 피벗 테이블 그룹화 기준 주 번호, 요일 등 ... 잠금 해제되고 잠긴 셀 표시 다른 색상으로; 수식 / 이름이있는 셀 강조 표시...
kte 탭 201905
  • Word, Excel, PowerPoint에서 탭 편집 및 읽기 사용, Publisher, Access, Visio 및 Project.
  • 새 창이 아닌 동일한 창의 새 탭에서 여러 문서를 열고 만듭니다.
  • 생산성을 50% 높이고 매일 수백 번의 마우스 클릭을 줄입니다!
officetab 하단
Comments (1)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hello,

First off, I do not know VBA, but have determined after hours of searching, it is the only solution to my problem.

Background:
I have a workbook with a large number of Power Query-created "Merge"-type Queries and Queries that pull data from flat files; some, but not all are added to the Data Model/Power Pivot.

The composition of queries may change over time.

Within a subset of the queries, I have disabled refreshing with "Refresh All" to reduce the already lengthy time it takes to refresh all queries.

There are a large number of worksheets that contain Pivots off the Data Model, whereas the others contain a subset of tables that are populated from the queries via "Load To"

I am using O365 Excel

The example code below is based on hours of research. I don't know if it's of value in achieving my objectives below, but I'm including it in the event it sparks a solution.

Objectives:
I would like an "index" worksheet created containing a dynamic table (or just listed out in cells that I can convert to a table manually) that keeps an up-to-date list of workbook "Query-" queries and their respective properties below.

The dynamic (e.g., reflect added/changed/deleted queries) table should contain the following columns with the following query/connection properties as fields:
-----------------------------------------------------
"Name", "Description", "RefreshWithRefreshAll", "InModel", "Type"

The following example is what I was able to cobble together from the interwebs which got me some of the way there, but it only allows me to see it in the VBA Immediate window, and I don't know how to get it into a table on the worksheet:

Sub ListConnections()

Dim cn As WorkbookConnection

Debug.Print "Name", "|", "Description", "|", "|", "RefreshWithRefreshAll", "|", "InModel", "|", "Type"


For Each cn In ThisWorkbook.Connections
Debug.Print cn.Name, "|", cn.Description, "|", cn.RefreshWithRefreshAll, "|", cn.InModel, "|", cn.Type

Next
End Sub-----------------------------------------------------

Currently, I can only get it to output in the Immediate Window:
-----------------------------------------------------
Name|Description||RefreshWithRefreshAll|InModel|Type
ModelConnection_ExternalData_1|DataModel|True|True|7
ModelConnection_ExternalData_11|DataModel|True|True|7
Query-AllADMembers(CX)|Connectiontothe'AllADMembers(CX)'queryintheworkbook.|True|True|1
Query-AllAzureADUsers-Disabled|Connectiontothe'AllAzureADUsers-Disabled'queryintheworkbook.|True|False|1
Query-AllAzureADUsers-Enabled|Connectiontothe'AllAzureADUsers-Enabled'queryintheworkbook.|True|False|1
Query-AllAzureADUsersOnly|Connectiontothe'AllAzureADUsersOnly'queryintheworkbook.|True|False|1
...

Query-UsersinDA,NotinApp-BulkDEL*|Connectiontothe'UsersinDA,NotinApp-BulkDEL*'queryintheworkbook.|False|True|1
ThisWorkbookDataModel|DataModel|True|True|7
-----------------------------------------------------
Note 1: I used the convention of adding an asterisk to the query name to visually see which queries I disabled refreshing with Refresh All.
Note 2: Query names with (CNX) refer to the base queries to the flat files upon which the other merge queries are based.
Note 3: The "Last Refresh" field in the table would be the Date/Time of the Last Refresh of the query. I was hoping it could be obtained as a property of the query, since this timestamp is shown when hovering over the query in the query pane, e.g.

<br style="letter-spacing: 0.2px;">
Based on my searches, it does not appear that this is obtainable for some reason, but if not, I found other references to adding it as a calculated value using timestamps of macro executed refreshes.

Example: I found many references to adding a button to have a macro refresh one or refresh all queries. My thought is that one could create code to dynamically enumerate the names from the code above Query-[Query Name], then have the code execute a refresh of each (CNX) query above first, then execute the rest individually to capture the execution and/or finish timestamp. Since there is a natural sequence that Excel uses when doing a refresh all, executing queries manually may trigger the natural sequence multiple times making the overall refresh times unbearable. Looking for the most efficient solution here.

Here is some code that I thought would be useful to tackle this, but again, it only shows output in the Immediate Window when executed.
-----------------------------------------------------
Dim TStart As Date
Dim TEnd As Date
Dim cn As WorkbookConnection

For Each cn In ThisWorkbook.Connections

If Left(cn, 13) = "Power Query -" Then
Debug.Print cn
TStart = Now
cn.Refresh
TEnd = Now
Debug.Print CStr(DateDiff("s", TStart, TEnd)) + " Seconds"
Debug.Print ""

End If
Next cn
End Sub
-----------------------------------------------------
Thanks in advance!

M
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations