본문으로 이동
주 메뉴
주 메뉴
사이드바로 이동
숨기기
둘러보기
대문
최근 바뀜
임의의 문서로
미디어위키 도움말
특수 문서 목록
lse
검색
검색
보이기
계정 만들기
로그인
개인 도구
계정 만들기
로그인
로그아웃한 편집자를 위한 문서
더 알아보기
기여
토론
Vba AI access
편집하기
문서
토론
한국어
읽기
편집
원본 편집
역사 보기
도구
도구
사이드바로 이동
숨기기
동작
읽기
편집
원본 편집
역사 보기
일반
여기를 가리키는 문서
가리키는 글의 최근 바뀜
문서 정보
보이기
사이드바로 이동
숨기기
경고:
로그인하지 않았습니다. 편집을 하면 IP 주소가 공개되게 됩니다.
로그인
하거나
계정을 생성하면
편집자가 사용자 이름으로 기록되고, 다른 장점도 있습니다.
스팸 방지 검사입니다. 이것을 입력하지
마세요
!
AI access를 엑셀에서 접근하려고 할 때 =VBA사용= =크롬 사용= selenium 활용 Dim options As New ChromeOptions '객체 인식 오류 나는 코드 <code> Sub OpenChromeWithProfile() Dim driver As New ChromeDriver Dim options As New ChromeOptions Dim profilePath As String ' 사용하려는 Chrome 프로필 경로 설정 ' 일반적인 프로필 경로 예시 (사용자 환경에 맞게 수정 필요) profilePath = "C:\Users\YourUsername\AppData\Local\Google\Chrome\User Data\Profile 1" ' Chrome 옵션 설정 options.AddArgument "--user-data-dir=" & profilePath ' 추가 옵션 (필요시 주석 해제하여 사용) 'options.AddArgument "--start-maximized" ' 창 최대화 'options.AddArgument "--disable-extensions" ' 확장 프로그램 비활성화 ' 설정된 옵션으로 Chrome 시작 driver.Start "chrome", options ' 웹사이트 열기 (예: Google) driver.Get "https://www.google.com" ' 여기에 필요한 추가 작업 코드 작성 ' 브라우저 유지 (즉시 종료하지 않음) ' 나중에 브라우저를 닫으려면 driver.Quit 사용 ' driver.Quit End Sub Function GetChromeProfiles() As Collection ' Chrome 프로필 목록 가져오기 Dim profiles As New Collection Dim userDataDir As String Dim fso As Object Dim folder As Object Dim subFolder As Object ' FileSystemObject 생성 Set fso = CreateObject("Scripting.FileSystemObject") ' Chrome 사용자 데이터 디렉토리 경로 (일반적인 위치) userDataDir = Environ("LOCALAPPDATA") & "\Google\Chrome\User Data" ' 디렉토리 존재 확인 If fso.FolderExists(userDataDir) Then Set folder = fso.GetFolder(userDataDir) ' Default 프로필 추가 profiles.Add userDataDir & "\Default", "Default" ' 추가 프로필 폴더 탐색 For Each subFolder In folder.SubFolders If InStr(subFolder.Name, "Profile") > 0 Then profiles.Add userDataDir & "\" & subFolder.Name, subFolder.Name End If Next subFolder End If Set GetChromeProfiles = profiles End Function Sub SelectProfileAndLaunchChrome() ' 프로필 선택하고 Chrome 실행하기 Dim profiles As Collection Dim profile As Variant Dim selectedProfile As String Dim profileNames() As String Dim i As Integer Dim selectedIndex As Integer ' 프로필 목록 가져오기 Set profiles = GetChromeProfiles() ' 프로필이 없으면 종료 If profiles.Count = 0 Then MsgBox "Chrome 프로필을 찾을 수 없습니다.", vbExclamation Exit Sub End If ' 프로필 이름 배열 만들기 ReDim profileNames(1 To profiles.Count) i = 1 For Each profile In profiles profileNames(i) = profiles(i) i = i + 1 Next profile ' 사용자에게 프로필 선택 요청 selectedIndex = Application.InputBox("사용할 Chrome 프로필 번호를 선택하세요 (1-" & profiles.Count & "):" & vbNewLine & _ Join(profileNames, vbNewLine), Type:=1) ' 취소 확인 If selectedIndex < 1 Or selectedIndex > profiles.Count Then MsgBox "유효한 프로필을 선택하지 않았습니다.", vbExclamation Exit Sub End If ' 선택된 프로필로 Chrome 실행 selectedProfile = profiles(selectedIndex) ' Chrome 드라이버 생성 및 실행 Dim driver As New ChromeDriver Dim options As New ChromeOptions options.AddArgument "--user-data-dir=" & selectedProfile driver.Start "chrome", options ' 테스트용 URL 열기 driver.Get "https://www.google.com" MsgBox "Chrome이 " & profileNames(selectedIndex) & " 프로필로 실행되었습니다.", vbInformation End Sub </code>
요약:
lse에서의 모든 기여는 다른 기여자가 편집, 수정, 삭제할 수 있다는 점을 유의해 주세요. 만약 여기에 동의하지 않는다면, 문서를 저장하지 말아 주세요.
또한, 직접 작성했거나 퍼블릭 도메인과 같은 자유 문서에서 가져왔다는 것을 보증해야 합니다(자세한 사항은
Lse:저작권
문서를 보세요).
저작권이 있는 내용을 허가 없이 저장하지 마세요!
취소
편집 도움말
(새 창에서 열림)
검색
검색
Vba AI access
편집하기
새 주제