cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
887
Views
10
Helpful
3
Replies

BAT excel files - from Windows7 32bit to Windows10 64bit

lleweyiss
Level 4
Level 4

CUCM 10.5.2

New laptop is Windows10 64bit  - Old laptop Windows7 32bit  

BAT excel files on my Win7 moved to Win10 machine.

When I try and fill in a field (adding some phones), I get a pop up with "microsoft visual basic for application"  code for the BAT sheet. I click ok, but each cell in Excel I enter info into gets this pop up,  happens over and over.

 

(not my area of expertise, I didn't realize that VBA code was there - vendor installed original version of CUCM many years ago and a few versions ago - this never popped up previously)

 

Error pop up  = "The code in the project must be updated for use on 64-bit systems. Please review and update Declare statements and them mark them with the PtrSafe attribute."

 

I have no experience with Visual Basic for Applications or implications to this BAT excel sheet if I make some uneducated guesses. The code has the first (3) Private Declare statements in RED - which is where I assume something needs to change. 

Search of internet , old posts suggest putting "PtrSafe" in the Declare statement ,but no posts reference CUCM.  Looked at all the "BAT" references here in the community, nothing here either.

The below are the (3) in RED Declare statements:

 

Private Declare Function SHBrowseForFolder _
Lib "shell32" _
( _
lpbi As BrowseInfo _
) _
As Long

Private Declare Function SHGetPathFromIDList _
Lib "shell32" _
( _
ByVal pidList As Long, _
ByVal lpBuffer As String _
) _
As Long

Private Declare Function lstrcat _
Lib "kernel32" _
Alias "lstrcatA" _
( _
ByVal lpString1 As String, _
ByVal lpString2 As String _
) _
As Long

 

Any advice ?  Will the insertion of PtrSafe  in Declare statement fix issue? (in between 'Declare' and 'Function' ?)

 

 

3 Replies 3

Anthony Holloway
Cisco Employee
Cisco Employee
I hope you get some good tips here. I have an OK one for you: don't use that file. It's not required, and it's kind of over kill. You can build insert things by looking at the sample files, creating templates, and expiring examples. That's how I do all of my BAT work I haven't used that bat xlt in a long time.
Just a thought.

Hi Anthony,

Thanks for the response, the BAT file was a little overkill but I was used to quick entry into the Excel spreadsheet. Seems faster than creating the csv / or txt file .... but that may be just because I am used to using Excel for a lot of things.

I will use your suggestion ... maybe someone will come along and share other ways for us to try.

alejo1521
Level 1
Level 1

here the solution. 

On VBA Code add PtrSafe after the Declare statements, *** TIP: Save file as .XLT

 

32Bit Config -  VBA64Bit Config -  VBA

Private Declare Function SHBrowseForFolder _
Lib "shell32" _
( _
lpbi As BrowseInfo _
) _
As Long

Private Declare Function SHGetPathFromIDList _
Lib "shell32" _
( _
ByVal pidList As Long, _
ByVal lpBuffer As String _
) _
As Long

Private Declare Function lstrcat _
Lib "kernel32" _
Alias "lstrcatA" _
( _
ByVal lpString1 As String, _
ByVal lpString2 As String _
) _
As Long

Private Declare PtrSafe Function SHBrowseForFolder _
Lib "shell32" _
( _
lpbi As BrowseInfo _
) _
As Long

Private Declare PtrSafe Function SHGetPathFromIDList _
Lib "shell32" _
( _
ByVal pidList As Long, _
ByVal lpBuffer As String _
) _
As Long

Private Declare PtrSafe Function lstrcat _
Lib "kernel32" _
Alias "lstrcatA" _
( _
ByVal lpString1 As String, _
ByVal lpString2 As String _
) _
As Long