Skip to content

Commit cf6063d

Browse files
authored
Change code snippets to Visual Basic in documentation
Updated code snippets in the documentation to use Visual Basic instead of Python. Added instructions for calculating area using a Python script from Excel.
1 parent 706c46a commit cf6063d

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

_posts/python/2025-02-04-run-python-from-excel.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ main_worksheet["B4"].value = area
7878
> Triple quote `"""` is used to escape double quotes in VBA, don't remove it. Your script won't run without those quotes
7979
{: .prompt-tip }
8080

81-
```python
81+
```visualbasic
8282
Sub CalculateArea()
8383
Dim objShell As Object
8484
Set objShell = VBA.CreateObject("Wscript.Shell")
@@ -101,7 +101,7 @@ End Sub
101101
- In simple terms `Excel file path\Sample.py` will be our python script path
102102
- So, update your python script path as shown below
103103

104-
```python
104+
```visualbasic
105105
Sub CalculateArea()
106106
Dim objShell As Object
107107
Set objShell = VBA.CreateObject("Wscript.Shell")
@@ -115,11 +115,13 @@ Sub CalculateArea()
115115
objShell.Run PythonExePath & " " & PythonScriptPath, 0
116116
End Sub
117117
```
118+
118119
### Getting python exe path from Windows Registry
119120
- In case you're planning to share this script with multiple people or running on different system
120121
- you'll have to use inbuilt python path from Windows registry
121122
- Use below code snippet to get python exe path from registry
122-
```vba
123+
124+
```visualbasic
123125
Sub CalculateArea()
124126
125127
Dim scriptName As String

0 commit comments

Comments
 (0)