回答編集履歴
1
追記
answer
CHANGED
@@ -17,6 +17,10 @@
|
|
17
17
|
それはまずいですよね。
|
18
18
|
|
19
19
|
```vb
|
20
|
+
Dim SHE As Object
|
21
|
+
Dim QIT As Object
|
22
|
+
Dim CIG As Integer
|
23
|
+
|
20
24
|
Set SHE = CreateObject("Shell.Application")
|
21
25
|
For CIG = SHE.Windows.Count To 1 Step -1
|
22
26
|
Set QIT = SHE.Windows(CIG - 1)
|
@@ -25,4 +29,39 @@
|
|
25
29
|
End If
|
26
30
|
Next
|
27
31
|
|
28
|
-
```
|
32
|
+
```
|
33
|
+
|
34
|
+
追記
|
35
|
+
---
|
36
|
+
手動でIEを開いて、上記のコードを実行するとエラーなくIEが閉じます。ということは、このコード自体に問題はないということです。
|
37
|
+
> 回答有難うございます。実はそちらの手法を既に試したのですが、タスクマネージャーを開いて見るとIEのプロセスが残ったままでした。
|
38
|
+
|
39
|
+
質問のコードで、IEを開くところのみ抜き出してみると、下記のようになります。
|
40
|
+
```
|
41
|
+
Dim interNet5 As InternetExplorer
|
42
|
+
Dim interNet4 As InternetExplorer
|
43
|
+
Dim interNet3 As InternetExplorer
|
44
|
+
Dim interNet2 As InternetExplorer
|
45
|
+
Dim interNet As InternetExplorer
|
46
|
+
|
47
|
+
Set interNet2 = CreateObject("Internetexplorer.Application")
|
48
|
+
|
49
|
+
For Each EL In Colect
|
50
|
+
|
51
|
+
Set interNet3 = CreateObject("Internetexplorer.Application")
|
52
|
+
|
53
|
+
Set interNet4 = CreateObject("Internetexplorer.Application")
|
54
|
+
|
55
|
+
For Each ELD In Colect3
|
56
|
+
|
57
|
+
Set interNet5 = CreateObject("Internetexplorer.Application")
|
58
|
+
|
59
|
+
Next ELD
|
60
|
+
|
61
|
+
Next EL
|
62
|
+
```
|
63
|
+
Forループの中で何度も CreateObject して、同じ変数に代入しています。
|
64
|
+
繰り返し代入する前に、ちゃんと Quit で閉じる処理をしてますか。
|
65
|
+
閉じないで代入してしまうと、その IE は幽霊となってしまって、プログラムからは制御できなくなります。
|
66
|
+
|
67
|
+
想定外の動きをするときに、その原因をつきとめてそこで解決せずに、別の手段に逃げるのは本質的な解決にはなりません。
|