How do I fix error for 64-bit VBA PPT converted from 32-bit










0














This VBA program worked for 32-bit PPT 2007 but when I used it for 64-bit PPT 2013, there was an error even when I added PtrSafe infront of Public Declare.



There was a type miss match in this function: AddressOf BrowseCallbackProc
(in the middle of Public Function Get_IMGFolderName())



I would like some advice on how to solve this problem.
I have been coding as a hobby so I do not know much.



Thankyou



Option Explicit

Public Declare PtrSafe Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Public Declare PtrSafe Function SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) As Long
Public Declare PtrSafe Function SHGetPathFromIDList Lib "shell32" (ByVal pidList As Long, ByVal lpBuffer As String) As Long
Public Declare PtrSafe Function lstrcat Lib "kernel32" Alias "lstrcatA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long

Public Type BrowseInfo
hwndOwner As Long
pIDLRoot As Long
pszDisplayName As Long
lpszstrMsg As Long
ulFlags As Long
lpfnCallback As Long
lParam As Long
iImage As Long
End Type

Public Const BIF_STATUSTEXT = &H4&
Public Const BIF_RETURNONLYFSDIRS = 1
Public Const BIF_DONTGOBELOWDOMAIN = 2
Public Const MAX_PATH = 260
Public Const WM_USER = &H400
Public Const BFFM_INITIALIZED = 1
Public Const BFFM_SELCHANGED = 2
Public Const BFFM_SETSTATUSTEXT = (WM_USER + 100)
Public Const BFFM_SETSELECTION = (WM_USER + 102)

Public strCurDir As String '현재 디렉토리

Public Enum CHOOSE_COLOR_FLAGS
CC_RGBINIT = &H1&
CC_FULLOPEN = &H2&
CC_PREVENTFULLOPEN = &H4&
CC_SHOWHELP = &H8&
CC_ENABLEHOOK = &H10&
CC_ENABLETEMPLATE = &H20&
CC_ENABLETEMPLATEHANDLE = &H40&
CC_SOLIDCOLOR = &H80&
CC_ANYCOLOR = &H100&
End Enum

Private Type CHOOSECOLOR
lStructSize As Long
hwndOwner As Long
hInstance As Long
rgbResult As Long
lpCustColors As Long
flags As CHOOSE_COLOR_FLAGS
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type

Private Declare PtrSafe Function ChooseColor_API Lib "comdlg32.dll" Alias "ChooseColorA" (lpChoosecolor As CHOOSECOLOR) As Long



Function Delete_Sheets()

'ActiveWindow.View.GotoSlide ActivePresentation.Slides.Count
While ActivePresentation.Slides.Count > 0
ActiveWindow.Selection.SlideRange.Delete
Wend

End Function



Public Function Get_IMGFolderName() As String

Dim lpIDList As Long
Dim szstrMsg As String
Dim strBuffer As String
Dim tBrowseInfo As BrowseInfo
Dim strDir As String

strCurDir = frmBible.lblIMGFolder.Caption & vbNullChar

szstrMsg = "바탕그림용 이미지가 들어 있는 폴더를 지정해주세요"
With tBrowseInfo
.hwndOwner = 0
.lpszstrMsg = lstrcat(szstrMsg, "")
.ulFlags = BIF_RETURNONLYFSDIRS + BIF_DONTGOBELOWDOMAIN + BIF_STATUSTEXT
.lpfnCallback = GetAddressofFunction(AddressOf BrowseCallbackProc) 'get address of function.
End With

lpIDList = SHBrowseForFolder(tBrowseInfo)
If (lpIDList) Then
strBuffer = Space(MAX_PATH)
SHGetPathFromIDList lpIDList, strBuffer
strBuffer = Left(strBuffer, InStr(strBuffer, vbNullChar) - 1)
Get_IMGFolderName = strBuffer
Else
Get_IMGFolderName = ""
End If

End Function



Public Function Remove_Special_Chars(intxt) As String

Dim wkstr As String
Dim p As Integer, c, uc

wkstr = ""
While Len(intxt) > 0
c = Left(intxt, 1)
uc = UCase(c)
If c >= "가" And c <= "힝" Then
wkstr = wkstr & c
ElseIf uc >= "A" And uc <= "Z" Then
wkstr = wkstr & c
ElseIf uc >= "0" And uc <= "9" Then
wkstr = wkstr & c
End If
intxt = Mid(intxt, 2)
Wend

Remove_Special_Chars = wkstr

End Function




Public Function Return_PathName(full_Path As String)

'return path name only

Dim p As Integer, ps As Integer

ps = 1
p = 1
Do While p > 0
p = InStr(ps, full_Path, "", vbBinaryCompare)
If p > 0 Then
ps = p + 1
End If
Loop

Return_PathName = Left(full_Path, ps - 1)

End Function

Public Function Return_FileName(full_Path As String)

' return file name only

Dim p As Integer, ps As Integer

ps = 1
p = 1
Do While p > 0
p = InStr(ps, full_Path, "", vbBinaryCompare)
If p > 0 Then
ps = p + 1
End If
Loop

Return_FileName = Mid(full_Path, ps)

End Function

Public Function Return_FolderName(full_Path)

' return folder name only

Dim p As Integer

p = InStrRev(full_Path, "", Len(full_Path) - 1)

Return_FolderName = Mid(full_Path, p + 1)

End Function





Public Function BrowseCallbackProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal lp As Long, ByVal pData As Long) As Long
Dim lpIDList As Long
Dim lngRet As Long
Dim strBuffer As String

On Error Resume Next

Select Case uMsg

Case BFFM_INITIALIZED
Call SendMessage(hWnd, BFFM_SETSELECTION, 1, strCurDir)

Case BFFM_SELCHANGED
strBuffer = Space(MAX_PATH)

lngRet = SHGetPathFromIDList(lp, strBuffer)
If lngRet = 1 Then
Call SendMessage(hWnd, BFFM_SETSTATUSTEXT, 0, strBuffer)
End If

End Select
On Error GoTo 0

BrowseCallbackProc = 0

End Function



Public Function GetAddressofFunction(lngAdd As Long) As Long

GetAddressofFunction = lngAdd

End Function


Public Function FileDateInfo(filespec)
Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(filespec)
FileDateInfo = f.DateLastModified

End Function


Public Function WinRegistry_CommonGet()

Dim TmpName As String
Dim i As Integer
Dim x

Version_Release = GetSetting("BibleChoir", "LatestVal", "Version_Release", "vv.rr")


frmBible.lblIMGFolder.Caption = GetSetting("BibleChoir", "LatestVal", "IMGFolder", "없음")
'frmPicture.sldBright = GetSetting(appname:="BibleChoir", section:="LatestVal", key:="Bright", Default:=70)
frmBible.chkEachPage = GetSetting("BibleChoir", "LatestVal", "EachPage", False)

File2Open = frmBible.lblIMGFolder.Caption


If File2Open <> "없음" Then
On Error Resume Next
frmBible.ImgPreview.Picture = LoadPicture(File2Open)
End If
On Error GoTo 0
End Function

Public Function WinRegistry_CommonSave()

Dim i As Integer

SaveSetting "BibleChoir", "LatestVal", "Version_Release", Version_Release

SaveSetting "BibleChoir", "LatestVal", "IMGFolder", frmBible.lblIMGFolder.Caption
'SaveSetting "BibleChoir", "LatestVal", "Bright", frmPicture.sldBright
SaveSetting "BibleChoir", "LatestVal", "EachPage", frmBible.chkEachPage


End Function









share|improve this question




























    0














    This VBA program worked for 32-bit PPT 2007 but when I used it for 64-bit PPT 2013, there was an error even when I added PtrSafe infront of Public Declare.



    There was a type miss match in this function: AddressOf BrowseCallbackProc
    (in the middle of Public Function Get_IMGFolderName())



    I would like some advice on how to solve this problem.
    I have been coding as a hobby so I do not know much.



    Thankyou



    Option Explicit

    Public Declare PtrSafe Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
    Public Declare PtrSafe Function SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) As Long
    Public Declare PtrSafe Function SHGetPathFromIDList Lib "shell32" (ByVal pidList As Long, ByVal lpBuffer As String) As Long
    Public Declare PtrSafe Function lstrcat Lib "kernel32" Alias "lstrcatA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long

    Public Type BrowseInfo
    hwndOwner As Long
    pIDLRoot As Long
    pszDisplayName As Long
    lpszstrMsg As Long
    ulFlags As Long
    lpfnCallback As Long
    lParam As Long
    iImage As Long
    End Type

    Public Const BIF_STATUSTEXT = &H4&
    Public Const BIF_RETURNONLYFSDIRS = 1
    Public Const BIF_DONTGOBELOWDOMAIN = 2
    Public Const MAX_PATH = 260
    Public Const WM_USER = &H400
    Public Const BFFM_INITIALIZED = 1
    Public Const BFFM_SELCHANGED = 2
    Public Const BFFM_SETSTATUSTEXT = (WM_USER + 100)
    Public Const BFFM_SETSELECTION = (WM_USER + 102)

    Public strCurDir As String '현재 디렉토리

    Public Enum CHOOSE_COLOR_FLAGS
    CC_RGBINIT = &H1&
    CC_FULLOPEN = &H2&
    CC_PREVENTFULLOPEN = &H4&
    CC_SHOWHELP = &H8&
    CC_ENABLEHOOK = &H10&
    CC_ENABLETEMPLATE = &H20&
    CC_ENABLETEMPLATEHANDLE = &H40&
    CC_SOLIDCOLOR = &H80&
    CC_ANYCOLOR = &H100&
    End Enum

    Private Type CHOOSECOLOR
    lStructSize As Long
    hwndOwner As Long
    hInstance As Long
    rgbResult As Long
    lpCustColors As Long
    flags As CHOOSE_COLOR_FLAGS
    lCustData As Long
    lpfnHook As Long
    lpTemplateName As String
    End Type

    Private Declare PtrSafe Function ChooseColor_API Lib "comdlg32.dll" Alias "ChooseColorA" (lpChoosecolor As CHOOSECOLOR) As Long



    Function Delete_Sheets()

    'ActiveWindow.View.GotoSlide ActivePresentation.Slides.Count
    While ActivePresentation.Slides.Count > 0
    ActiveWindow.Selection.SlideRange.Delete
    Wend

    End Function



    Public Function Get_IMGFolderName() As String

    Dim lpIDList As Long
    Dim szstrMsg As String
    Dim strBuffer As String
    Dim tBrowseInfo As BrowseInfo
    Dim strDir As String

    strCurDir = frmBible.lblIMGFolder.Caption & vbNullChar

    szstrMsg = "바탕그림용 이미지가 들어 있는 폴더를 지정해주세요"
    With tBrowseInfo
    .hwndOwner = 0
    .lpszstrMsg = lstrcat(szstrMsg, "")
    .ulFlags = BIF_RETURNONLYFSDIRS + BIF_DONTGOBELOWDOMAIN + BIF_STATUSTEXT
    .lpfnCallback = GetAddressofFunction(AddressOf BrowseCallbackProc) 'get address of function.
    End With

    lpIDList = SHBrowseForFolder(tBrowseInfo)
    If (lpIDList) Then
    strBuffer = Space(MAX_PATH)
    SHGetPathFromIDList lpIDList, strBuffer
    strBuffer = Left(strBuffer, InStr(strBuffer, vbNullChar) - 1)
    Get_IMGFolderName = strBuffer
    Else
    Get_IMGFolderName = ""
    End If

    End Function



    Public Function Remove_Special_Chars(intxt) As String

    Dim wkstr As String
    Dim p As Integer, c, uc

    wkstr = ""
    While Len(intxt) > 0
    c = Left(intxt, 1)
    uc = UCase(c)
    If c >= "가" And c <= "힝" Then
    wkstr = wkstr & c
    ElseIf uc >= "A" And uc <= "Z" Then
    wkstr = wkstr & c
    ElseIf uc >= "0" And uc <= "9" Then
    wkstr = wkstr & c
    End If
    intxt = Mid(intxt, 2)
    Wend

    Remove_Special_Chars = wkstr

    End Function




    Public Function Return_PathName(full_Path As String)

    'return path name only

    Dim p As Integer, ps As Integer

    ps = 1
    p = 1
    Do While p > 0
    p = InStr(ps, full_Path, "", vbBinaryCompare)
    If p > 0 Then
    ps = p + 1
    End If
    Loop

    Return_PathName = Left(full_Path, ps - 1)

    End Function

    Public Function Return_FileName(full_Path As String)

    ' return file name only

    Dim p As Integer, ps As Integer

    ps = 1
    p = 1
    Do While p > 0
    p = InStr(ps, full_Path, "", vbBinaryCompare)
    If p > 0 Then
    ps = p + 1
    End If
    Loop

    Return_FileName = Mid(full_Path, ps)

    End Function

    Public Function Return_FolderName(full_Path)

    ' return folder name only

    Dim p As Integer

    p = InStrRev(full_Path, "", Len(full_Path) - 1)

    Return_FolderName = Mid(full_Path, p + 1)

    End Function





    Public Function BrowseCallbackProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal lp As Long, ByVal pData As Long) As Long
    Dim lpIDList As Long
    Dim lngRet As Long
    Dim strBuffer As String

    On Error Resume Next

    Select Case uMsg

    Case BFFM_INITIALIZED
    Call SendMessage(hWnd, BFFM_SETSELECTION, 1, strCurDir)

    Case BFFM_SELCHANGED
    strBuffer = Space(MAX_PATH)

    lngRet = SHGetPathFromIDList(lp, strBuffer)
    If lngRet = 1 Then
    Call SendMessage(hWnd, BFFM_SETSTATUSTEXT, 0, strBuffer)
    End If

    End Select
    On Error GoTo 0

    BrowseCallbackProc = 0

    End Function



    Public Function GetAddressofFunction(lngAdd As Long) As Long

    GetAddressofFunction = lngAdd

    End Function


    Public Function FileDateInfo(filespec)
    Dim fs, f
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFile(filespec)
    FileDateInfo = f.DateLastModified

    End Function


    Public Function WinRegistry_CommonGet()

    Dim TmpName As String
    Dim i As Integer
    Dim x

    Version_Release = GetSetting("BibleChoir", "LatestVal", "Version_Release", "vv.rr")


    frmBible.lblIMGFolder.Caption = GetSetting("BibleChoir", "LatestVal", "IMGFolder", "없음")
    'frmPicture.sldBright = GetSetting(appname:="BibleChoir", section:="LatestVal", key:="Bright", Default:=70)
    frmBible.chkEachPage = GetSetting("BibleChoir", "LatestVal", "EachPage", False)

    File2Open = frmBible.lblIMGFolder.Caption


    If File2Open <> "없음" Then
    On Error Resume Next
    frmBible.ImgPreview.Picture = LoadPicture(File2Open)
    End If
    On Error GoTo 0
    End Function

    Public Function WinRegistry_CommonSave()

    Dim i As Integer

    SaveSetting "BibleChoir", "LatestVal", "Version_Release", Version_Release

    SaveSetting "BibleChoir", "LatestVal", "IMGFolder", frmBible.lblIMGFolder.Caption
    'SaveSetting "BibleChoir", "LatestVal", "Bright", frmPicture.sldBright
    SaveSetting "BibleChoir", "LatestVal", "EachPage", frmBible.chkEachPage


    End Function









    share|improve this question


























      0












      0








      0







      This VBA program worked for 32-bit PPT 2007 but when I used it for 64-bit PPT 2013, there was an error even when I added PtrSafe infront of Public Declare.



      There was a type miss match in this function: AddressOf BrowseCallbackProc
      (in the middle of Public Function Get_IMGFolderName())



      I would like some advice on how to solve this problem.
      I have been coding as a hobby so I do not know much.



      Thankyou



      Option Explicit

      Public Declare PtrSafe Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
      Public Declare PtrSafe Function SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) As Long
      Public Declare PtrSafe Function SHGetPathFromIDList Lib "shell32" (ByVal pidList As Long, ByVal lpBuffer As String) As Long
      Public Declare PtrSafe Function lstrcat Lib "kernel32" Alias "lstrcatA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long

      Public Type BrowseInfo
      hwndOwner As Long
      pIDLRoot As Long
      pszDisplayName As Long
      lpszstrMsg As Long
      ulFlags As Long
      lpfnCallback As Long
      lParam As Long
      iImage As Long
      End Type

      Public Const BIF_STATUSTEXT = &H4&
      Public Const BIF_RETURNONLYFSDIRS = 1
      Public Const BIF_DONTGOBELOWDOMAIN = 2
      Public Const MAX_PATH = 260
      Public Const WM_USER = &H400
      Public Const BFFM_INITIALIZED = 1
      Public Const BFFM_SELCHANGED = 2
      Public Const BFFM_SETSTATUSTEXT = (WM_USER + 100)
      Public Const BFFM_SETSELECTION = (WM_USER + 102)

      Public strCurDir As String '현재 디렉토리

      Public Enum CHOOSE_COLOR_FLAGS
      CC_RGBINIT = &H1&
      CC_FULLOPEN = &H2&
      CC_PREVENTFULLOPEN = &H4&
      CC_SHOWHELP = &H8&
      CC_ENABLEHOOK = &H10&
      CC_ENABLETEMPLATE = &H20&
      CC_ENABLETEMPLATEHANDLE = &H40&
      CC_SOLIDCOLOR = &H80&
      CC_ANYCOLOR = &H100&
      End Enum

      Private Type CHOOSECOLOR
      lStructSize As Long
      hwndOwner As Long
      hInstance As Long
      rgbResult As Long
      lpCustColors As Long
      flags As CHOOSE_COLOR_FLAGS
      lCustData As Long
      lpfnHook As Long
      lpTemplateName As String
      End Type

      Private Declare PtrSafe Function ChooseColor_API Lib "comdlg32.dll" Alias "ChooseColorA" (lpChoosecolor As CHOOSECOLOR) As Long



      Function Delete_Sheets()

      'ActiveWindow.View.GotoSlide ActivePresentation.Slides.Count
      While ActivePresentation.Slides.Count > 0
      ActiveWindow.Selection.SlideRange.Delete
      Wend

      End Function



      Public Function Get_IMGFolderName() As String

      Dim lpIDList As Long
      Dim szstrMsg As String
      Dim strBuffer As String
      Dim tBrowseInfo As BrowseInfo
      Dim strDir As String

      strCurDir = frmBible.lblIMGFolder.Caption & vbNullChar

      szstrMsg = "바탕그림용 이미지가 들어 있는 폴더를 지정해주세요"
      With tBrowseInfo
      .hwndOwner = 0
      .lpszstrMsg = lstrcat(szstrMsg, "")
      .ulFlags = BIF_RETURNONLYFSDIRS + BIF_DONTGOBELOWDOMAIN + BIF_STATUSTEXT
      .lpfnCallback = GetAddressofFunction(AddressOf BrowseCallbackProc) 'get address of function.
      End With

      lpIDList = SHBrowseForFolder(tBrowseInfo)
      If (lpIDList) Then
      strBuffer = Space(MAX_PATH)
      SHGetPathFromIDList lpIDList, strBuffer
      strBuffer = Left(strBuffer, InStr(strBuffer, vbNullChar) - 1)
      Get_IMGFolderName = strBuffer
      Else
      Get_IMGFolderName = ""
      End If

      End Function



      Public Function Remove_Special_Chars(intxt) As String

      Dim wkstr As String
      Dim p As Integer, c, uc

      wkstr = ""
      While Len(intxt) > 0
      c = Left(intxt, 1)
      uc = UCase(c)
      If c >= "가" And c <= "힝" Then
      wkstr = wkstr & c
      ElseIf uc >= "A" And uc <= "Z" Then
      wkstr = wkstr & c
      ElseIf uc >= "0" And uc <= "9" Then
      wkstr = wkstr & c
      End If
      intxt = Mid(intxt, 2)
      Wend

      Remove_Special_Chars = wkstr

      End Function




      Public Function Return_PathName(full_Path As String)

      'return path name only

      Dim p As Integer, ps As Integer

      ps = 1
      p = 1
      Do While p > 0
      p = InStr(ps, full_Path, "", vbBinaryCompare)
      If p > 0 Then
      ps = p + 1
      End If
      Loop

      Return_PathName = Left(full_Path, ps - 1)

      End Function

      Public Function Return_FileName(full_Path As String)

      ' return file name only

      Dim p As Integer, ps As Integer

      ps = 1
      p = 1
      Do While p > 0
      p = InStr(ps, full_Path, "", vbBinaryCompare)
      If p > 0 Then
      ps = p + 1
      End If
      Loop

      Return_FileName = Mid(full_Path, ps)

      End Function

      Public Function Return_FolderName(full_Path)

      ' return folder name only

      Dim p As Integer

      p = InStrRev(full_Path, "", Len(full_Path) - 1)

      Return_FolderName = Mid(full_Path, p + 1)

      End Function





      Public Function BrowseCallbackProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal lp As Long, ByVal pData As Long) As Long
      Dim lpIDList As Long
      Dim lngRet As Long
      Dim strBuffer As String

      On Error Resume Next

      Select Case uMsg

      Case BFFM_INITIALIZED
      Call SendMessage(hWnd, BFFM_SETSELECTION, 1, strCurDir)

      Case BFFM_SELCHANGED
      strBuffer = Space(MAX_PATH)

      lngRet = SHGetPathFromIDList(lp, strBuffer)
      If lngRet = 1 Then
      Call SendMessage(hWnd, BFFM_SETSTATUSTEXT, 0, strBuffer)
      End If

      End Select
      On Error GoTo 0

      BrowseCallbackProc = 0

      End Function



      Public Function GetAddressofFunction(lngAdd As Long) As Long

      GetAddressofFunction = lngAdd

      End Function


      Public Function FileDateInfo(filespec)
      Dim fs, f
      Set fs = CreateObject("Scripting.FileSystemObject")
      Set f = fs.GetFile(filespec)
      FileDateInfo = f.DateLastModified

      End Function


      Public Function WinRegistry_CommonGet()

      Dim TmpName As String
      Dim i As Integer
      Dim x

      Version_Release = GetSetting("BibleChoir", "LatestVal", "Version_Release", "vv.rr")


      frmBible.lblIMGFolder.Caption = GetSetting("BibleChoir", "LatestVal", "IMGFolder", "없음")
      'frmPicture.sldBright = GetSetting(appname:="BibleChoir", section:="LatestVal", key:="Bright", Default:=70)
      frmBible.chkEachPage = GetSetting("BibleChoir", "LatestVal", "EachPage", False)

      File2Open = frmBible.lblIMGFolder.Caption


      If File2Open <> "없음" Then
      On Error Resume Next
      frmBible.ImgPreview.Picture = LoadPicture(File2Open)
      End If
      On Error GoTo 0
      End Function

      Public Function WinRegistry_CommonSave()

      Dim i As Integer

      SaveSetting "BibleChoir", "LatestVal", "Version_Release", Version_Release

      SaveSetting "BibleChoir", "LatestVal", "IMGFolder", frmBible.lblIMGFolder.Caption
      'SaveSetting "BibleChoir", "LatestVal", "Bright", frmPicture.sldBright
      SaveSetting "BibleChoir", "LatestVal", "EachPage", frmBible.chkEachPage


      End Function









      share|improve this question















      This VBA program worked for 32-bit PPT 2007 but when I used it for 64-bit PPT 2013, there was an error even when I added PtrSafe infront of Public Declare.



      There was a type miss match in this function: AddressOf BrowseCallbackProc
      (in the middle of Public Function Get_IMGFolderName())



      I would like some advice on how to solve this problem.
      I have been coding as a hobby so I do not know much.



      Thankyou



      Option Explicit

      Public Declare PtrSafe Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
      Public Declare PtrSafe Function SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) As Long
      Public Declare PtrSafe Function SHGetPathFromIDList Lib "shell32" (ByVal pidList As Long, ByVal lpBuffer As String) As Long
      Public Declare PtrSafe Function lstrcat Lib "kernel32" Alias "lstrcatA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long

      Public Type BrowseInfo
      hwndOwner As Long
      pIDLRoot As Long
      pszDisplayName As Long
      lpszstrMsg As Long
      ulFlags As Long
      lpfnCallback As Long
      lParam As Long
      iImage As Long
      End Type

      Public Const BIF_STATUSTEXT = &H4&
      Public Const BIF_RETURNONLYFSDIRS = 1
      Public Const BIF_DONTGOBELOWDOMAIN = 2
      Public Const MAX_PATH = 260
      Public Const WM_USER = &H400
      Public Const BFFM_INITIALIZED = 1
      Public Const BFFM_SELCHANGED = 2
      Public Const BFFM_SETSTATUSTEXT = (WM_USER + 100)
      Public Const BFFM_SETSELECTION = (WM_USER + 102)

      Public strCurDir As String '현재 디렉토리

      Public Enum CHOOSE_COLOR_FLAGS
      CC_RGBINIT = &H1&
      CC_FULLOPEN = &H2&
      CC_PREVENTFULLOPEN = &H4&
      CC_SHOWHELP = &H8&
      CC_ENABLEHOOK = &H10&
      CC_ENABLETEMPLATE = &H20&
      CC_ENABLETEMPLATEHANDLE = &H40&
      CC_SOLIDCOLOR = &H80&
      CC_ANYCOLOR = &H100&
      End Enum

      Private Type CHOOSECOLOR
      lStructSize As Long
      hwndOwner As Long
      hInstance As Long
      rgbResult As Long
      lpCustColors As Long
      flags As CHOOSE_COLOR_FLAGS
      lCustData As Long
      lpfnHook As Long
      lpTemplateName As String
      End Type

      Private Declare PtrSafe Function ChooseColor_API Lib "comdlg32.dll" Alias "ChooseColorA" (lpChoosecolor As CHOOSECOLOR) As Long



      Function Delete_Sheets()

      'ActiveWindow.View.GotoSlide ActivePresentation.Slides.Count
      While ActivePresentation.Slides.Count > 0
      ActiveWindow.Selection.SlideRange.Delete
      Wend

      End Function



      Public Function Get_IMGFolderName() As String

      Dim lpIDList As Long
      Dim szstrMsg As String
      Dim strBuffer As String
      Dim tBrowseInfo As BrowseInfo
      Dim strDir As String

      strCurDir = frmBible.lblIMGFolder.Caption & vbNullChar

      szstrMsg = "바탕그림용 이미지가 들어 있는 폴더를 지정해주세요"
      With tBrowseInfo
      .hwndOwner = 0
      .lpszstrMsg = lstrcat(szstrMsg, "")
      .ulFlags = BIF_RETURNONLYFSDIRS + BIF_DONTGOBELOWDOMAIN + BIF_STATUSTEXT
      .lpfnCallback = GetAddressofFunction(AddressOf BrowseCallbackProc) 'get address of function.
      End With

      lpIDList = SHBrowseForFolder(tBrowseInfo)
      If (lpIDList) Then
      strBuffer = Space(MAX_PATH)
      SHGetPathFromIDList lpIDList, strBuffer
      strBuffer = Left(strBuffer, InStr(strBuffer, vbNullChar) - 1)
      Get_IMGFolderName = strBuffer
      Else
      Get_IMGFolderName = ""
      End If

      End Function



      Public Function Remove_Special_Chars(intxt) As String

      Dim wkstr As String
      Dim p As Integer, c, uc

      wkstr = ""
      While Len(intxt) > 0
      c = Left(intxt, 1)
      uc = UCase(c)
      If c >= "가" And c <= "힝" Then
      wkstr = wkstr & c
      ElseIf uc >= "A" And uc <= "Z" Then
      wkstr = wkstr & c
      ElseIf uc >= "0" And uc <= "9" Then
      wkstr = wkstr & c
      End If
      intxt = Mid(intxt, 2)
      Wend

      Remove_Special_Chars = wkstr

      End Function




      Public Function Return_PathName(full_Path As String)

      'return path name only

      Dim p As Integer, ps As Integer

      ps = 1
      p = 1
      Do While p > 0
      p = InStr(ps, full_Path, "", vbBinaryCompare)
      If p > 0 Then
      ps = p + 1
      End If
      Loop

      Return_PathName = Left(full_Path, ps - 1)

      End Function

      Public Function Return_FileName(full_Path As String)

      ' return file name only

      Dim p As Integer, ps As Integer

      ps = 1
      p = 1
      Do While p > 0
      p = InStr(ps, full_Path, "", vbBinaryCompare)
      If p > 0 Then
      ps = p + 1
      End If
      Loop

      Return_FileName = Mid(full_Path, ps)

      End Function

      Public Function Return_FolderName(full_Path)

      ' return folder name only

      Dim p As Integer

      p = InStrRev(full_Path, "", Len(full_Path) - 1)

      Return_FolderName = Mid(full_Path, p + 1)

      End Function





      Public Function BrowseCallbackProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal lp As Long, ByVal pData As Long) As Long
      Dim lpIDList As Long
      Dim lngRet As Long
      Dim strBuffer As String

      On Error Resume Next

      Select Case uMsg

      Case BFFM_INITIALIZED
      Call SendMessage(hWnd, BFFM_SETSELECTION, 1, strCurDir)

      Case BFFM_SELCHANGED
      strBuffer = Space(MAX_PATH)

      lngRet = SHGetPathFromIDList(lp, strBuffer)
      If lngRet = 1 Then
      Call SendMessage(hWnd, BFFM_SETSTATUSTEXT, 0, strBuffer)
      End If

      End Select
      On Error GoTo 0

      BrowseCallbackProc = 0

      End Function



      Public Function GetAddressofFunction(lngAdd As Long) As Long

      GetAddressofFunction = lngAdd

      End Function


      Public Function FileDateInfo(filespec)
      Dim fs, f
      Set fs = CreateObject("Scripting.FileSystemObject")
      Set f = fs.GetFile(filespec)
      FileDateInfo = f.DateLastModified

      End Function


      Public Function WinRegistry_CommonGet()

      Dim TmpName As String
      Dim i As Integer
      Dim x

      Version_Release = GetSetting("BibleChoir", "LatestVal", "Version_Release", "vv.rr")


      frmBible.lblIMGFolder.Caption = GetSetting("BibleChoir", "LatestVal", "IMGFolder", "없음")
      'frmPicture.sldBright = GetSetting(appname:="BibleChoir", section:="LatestVal", key:="Bright", Default:=70)
      frmBible.chkEachPage = GetSetting("BibleChoir", "LatestVal", "EachPage", False)

      File2Open = frmBible.lblIMGFolder.Caption


      If File2Open <> "없음" Then
      On Error Resume Next
      frmBible.ImgPreview.Picture = LoadPicture(File2Open)
      End If
      On Error GoTo 0
      End Function

      Public Function WinRegistry_CommonSave()

      Dim i As Integer

      SaveSetting "BibleChoir", "LatestVal", "Version_Release", Version_Release

      SaveSetting "BibleChoir", "LatestVal", "IMGFolder", frmBible.lblIMGFolder.Caption
      'SaveSetting "BibleChoir", "LatestVal", "Bright", frmPicture.sldBright
      SaveSetting "BibleChoir", "LatestVal", "EachPage", frmBible.chkEachPage


      End Function






      vba powerpoint-vba






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 11 at 9:53









      K.Dᴀᴠɪs

      6,796112139




      6,796112139










      asked Nov 11 at 1:28









      HeeSu

      1




      1






















          1 Answer
          1






          active

          oldest

          votes


















          3














          You need to do more than just add the PtrSafe declaration. Some of your Long data types also need to be converted to LongPtr.



          #If VBA7 Then

          Public Declare PtrSafe Function SendMessage Lib "user32" Alias "SendMessageA" _
          (ByVal hWnd As LongPtr, ByVal wMsg As Long, ByVal wParam As LongPtr, _
          ByVal lParam As String) As LongPtr
          Public Declare PtrSafe Function SHBrowseForFolder Lib "shell32" _
          (lpbi As BrowseInfo) As LongPtr
          Public Declare PtrSafe Function SHGetPathFromIDList Lib "shell32" _
          (ByVal pidList As LongPtr, ByVal lpBuffer As String) As LongPtr
          Public Declare PtrSafe Function lstrcat Lib "kernel32" Alias "lstrcatA" _
          (ByVal lpString1 As String, ByVal lpString2 As String) As Long

          #Else

          Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
          (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
          ByVal lParam As String) As Long
          Public Declare Function SHBrowseForFolder Lib "shell32" _
          (lpbi As BrowseInfo) As Long
          Public Declare Function SHGetPathFromIDList Lib "shell32" _
          (ByVal pidList As Long, ByVal lpBuffer As String) As Long
          Public Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" _
          (ByVal lpString1 As String, ByVal lpString2 As String) As Long

          #End If



          From Microsoft Docs:




          Note Declare statements with the PtrSafe keyword is the recommended syntax. Declare statements that include PtrSafe work correctly in the VBA7 development environment on both 32-bit and 64-bit platforms only after all data types in the Declare statement (parameters and return values) that need to store 64-bit quantities are updated to use LongLong for 64-bit integrals or LongPtr for pointers and handles. To ensure backwards compatibility with VBA version 6 and earlier use the following construct:



          #If VBA7 Then 
          Declare PtrSafe Sub...
          #Else
          Declare Sub...
          #EndIf


          When running in 64-bit versions of Office Declare statements must include the PtrSafe keyword. The PtrSafe keyword asserts that a Declare statement is safe to run in 64-bit development environments. Adding the PtrSafe keyword to a Declare statement only signifies the Declare statement explicitly targets 64-bits, all data types within the statement that need to store 64-bits (including return values and parameters) must still be modified to hold 64-bit quantities using either LongLong for 64-bit integrals or LongPtr for pointers and handles.








          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245069%2fhow-do-i-fix-error-for-64-bit-vba-ppt-converted-from-32-bit%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            3














            You need to do more than just add the PtrSafe declaration. Some of your Long data types also need to be converted to LongPtr.



            #If VBA7 Then

            Public Declare PtrSafe Function SendMessage Lib "user32" Alias "SendMessageA" _
            (ByVal hWnd As LongPtr, ByVal wMsg As Long, ByVal wParam As LongPtr, _
            ByVal lParam As String) As LongPtr
            Public Declare PtrSafe Function SHBrowseForFolder Lib "shell32" _
            (lpbi As BrowseInfo) As LongPtr
            Public Declare PtrSafe Function SHGetPathFromIDList Lib "shell32" _
            (ByVal pidList As LongPtr, ByVal lpBuffer As String) As LongPtr
            Public Declare PtrSafe Function lstrcat Lib "kernel32" Alias "lstrcatA" _
            (ByVal lpString1 As String, ByVal lpString2 As String) As Long

            #Else

            Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
            (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
            ByVal lParam As String) As Long
            Public Declare Function SHBrowseForFolder Lib "shell32" _
            (lpbi As BrowseInfo) As Long
            Public Declare Function SHGetPathFromIDList Lib "shell32" _
            (ByVal pidList As Long, ByVal lpBuffer As String) As Long
            Public Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" _
            (ByVal lpString1 As String, ByVal lpString2 As String) As Long

            #End If



            From Microsoft Docs:




            Note Declare statements with the PtrSafe keyword is the recommended syntax. Declare statements that include PtrSafe work correctly in the VBA7 development environment on both 32-bit and 64-bit platforms only after all data types in the Declare statement (parameters and return values) that need to store 64-bit quantities are updated to use LongLong for 64-bit integrals or LongPtr for pointers and handles. To ensure backwards compatibility with VBA version 6 and earlier use the following construct:



            #If VBA7 Then 
            Declare PtrSafe Sub...
            #Else
            Declare Sub...
            #EndIf


            When running in 64-bit versions of Office Declare statements must include the PtrSafe keyword. The PtrSafe keyword asserts that a Declare statement is safe to run in 64-bit development environments. Adding the PtrSafe keyword to a Declare statement only signifies the Declare statement explicitly targets 64-bits, all data types within the statement that need to store 64-bits (including return values and parameters) must still be modified to hold 64-bit quantities using either LongLong for 64-bit integrals or LongPtr for pointers and handles.








            share|improve this answer



























              3














              You need to do more than just add the PtrSafe declaration. Some of your Long data types also need to be converted to LongPtr.



              #If VBA7 Then

              Public Declare PtrSafe Function SendMessage Lib "user32" Alias "SendMessageA" _
              (ByVal hWnd As LongPtr, ByVal wMsg As Long, ByVal wParam As LongPtr, _
              ByVal lParam As String) As LongPtr
              Public Declare PtrSafe Function SHBrowseForFolder Lib "shell32" _
              (lpbi As BrowseInfo) As LongPtr
              Public Declare PtrSafe Function SHGetPathFromIDList Lib "shell32" _
              (ByVal pidList As LongPtr, ByVal lpBuffer As String) As LongPtr
              Public Declare PtrSafe Function lstrcat Lib "kernel32" Alias "lstrcatA" _
              (ByVal lpString1 As String, ByVal lpString2 As String) As Long

              #Else

              Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
              (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
              ByVal lParam As String) As Long
              Public Declare Function SHBrowseForFolder Lib "shell32" _
              (lpbi As BrowseInfo) As Long
              Public Declare Function SHGetPathFromIDList Lib "shell32" _
              (ByVal pidList As Long, ByVal lpBuffer As String) As Long
              Public Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" _
              (ByVal lpString1 As String, ByVal lpString2 As String) As Long

              #End If



              From Microsoft Docs:




              Note Declare statements with the PtrSafe keyword is the recommended syntax. Declare statements that include PtrSafe work correctly in the VBA7 development environment on both 32-bit and 64-bit platforms only after all data types in the Declare statement (parameters and return values) that need to store 64-bit quantities are updated to use LongLong for 64-bit integrals or LongPtr for pointers and handles. To ensure backwards compatibility with VBA version 6 and earlier use the following construct:



              #If VBA7 Then 
              Declare PtrSafe Sub...
              #Else
              Declare Sub...
              #EndIf


              When running in 64-bit versions of Office Declare statements must include the PtrSafe keyword. The PtrSafe keyword asserts that a Declare statement is safe to run in 64-bit development environments. Adding the PtrSafe keyword to a Declare statement only signifies the Declare statement explicitly targets 64-bits, all data types within the statement that need to store 64-bits (including return values and parameters) must still be modified to hold 64-bit quantities using either LongLong for 64-bit integrals or LongPtr for pointers and handles.








              share|improve this answer

























                3












                3








                3






                You need to do more than just add the PtrSafe declaration. Some of your Long data types also need to be converted to LongPtr.



                #If VBA7 Then

                Public Declare PtrSafe Function SendMessage Lib "user32" Alias "SendMessageA" _
                (ByVal hWnd As LongPtr, ByVal wMsg As Long, ByVal wParam As LongPtr, _
                ByVal lParam As String) As LongPtr
                Public Declare PtrSafe Function SHBrowseForFolder Lib "shell32" _
                (lpbi As BrowseInfo) As LongPtr
                Public Declare PtrSafe Function SHGetPathFromIDList Lib "shell32" _
                (ByVal pidList As LongPtr, ByVal lpBuffer As String) As LongPtr
                Public Declare PtrSafe Function lstrcat Lib "kernel32" Alias "lstrcatA" _
                (ByVal lpString1 As String, ByVal lpString2 As String) As Long

                #Else

                Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
                (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
                ByVal lParam As String) As Long
                Public Declare Function SHBrowseForFolder Lib "shell32" _
                (lpbi As BrowseInfo) As Long
                Public Declare Function SHGetPathFromIDList Lib "shell32" _
                (ByVal pidList As Long, ByVal lpBuffer As String) As Long
                Public Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" _
                (ByVal lpString1 As String, ByVal lpString2 As String) As Long

                #End If



                From Microsoft Docs:




                Note Declare statements with the PtrSafe keyword is the recommended syntax. Declare statements that include PtrSafe work correctly in the VBA7 development environment on both 32-bit and 64-bit platforms only after all data types in the Declare statement (parameters and return values) that need to store 64-bit quantities are updated to use LongLong for 64-bit integrals or LongPtr for pointers and handles. To ensure backwards compatibility with VBA version 6 and earlier use the following construct:



                #If VBA7 Then 
                Declare PtrSafe Sub...
                #Else
                Declare Sub...
                #EndIf


                When running in 64-bit versions of Office Declare statements must include the PtrSafe keyword. The PtrSafe keyword asserts that a Declare statement is safe to run in 64-bit development environments. Adding the PtrSafe keyword to a Declare statement only signifies the Declare statement explicitly targets 64-bits, all data types within the statement that need to store 64-bits (including return values and parameters) must still be modified to hold 64-bit quantities using either LongLong for 64-bit integrals or LongPtr for pointers and handles.








                share|improve this answer














                You need to do more than just add the PtrSafe declaration. Some of your Long data types also need to be converted to LongPtr.



                #If VBA7 Then

                Public Declare PtrSafe Function SendMessage Lib "user32" Alias "SendMessageA" _
                (ByVal hWnd As LongPtr, ByVal wMsg As Long, ByVal wParam As LongPtr, _
                ByVal lParam As String) As LongPtr
                Public Declare PtrSafe Function SHBrowseForFolder Lib "shell32" _
                (lpbi As BrowseInfo) As LongPtr
                Public Declare PtrSafe Function SHGetPathFromIDList Lib "shell32" _
                (ByVal pidList As LongPtr, ByVal lpBuffer As String) As LongPtr
                Public Declare PtrSafe Function lstrcat Lib "kernel32" Alias "lstrcatA" _
                (ByVal lpString1 As String, ByVal lpString2 As String) As Long

                #Else

                Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
                (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
                ByVal lParam As String) As Long
                Public Declare Function SHBrowseForFolder Lib "shell32" _
                (lpbi As BrowseInfo) As Long
                Public Declare Function SHGetPathFromIDList Lib "shell32" _
                (ByVal pidList As Long, ByVal lpBuffer As String) As Long
                Public Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" _
                (ByVal lpString1 As String, ByVal lpString2 As String) As Long

                #End If



                From Microsoft Docs:




                Note Declare statements with the PtrSafe keyword is the recommended syntax. Declare statements that include PtrSafe work correctly in the VBA7 development environment on both 32-bit and 64-bit platforms only after all data types in the Declare statement (parameters and return values) that need to store 64-bit quantities are updated to use LongLong for 64-bit integrals or LongPtr for pointers and handles. To ensure backwards compatibility with VBA version 6 and earlier use the following construct:



                #If VBA7 Then 
                Declare PtrSafe Sub...
                #Else
                Declare Sub...
                #EndIf


                When running in 64-bit versions of Office Declare statements must include the PtrSafe keyword. The PtrSafe keyword asserts that a Declare statement is safe to run in 64-bit development environments. Adding the PtrSafe keyword to a Declare statement only signifies the Declare statement explicitly targets 64-bits, all data types within the statement that need to store 64-bits (including return values and parameters) must still be modified to hold 64-bit quantities using either LongLong for 64-bit integrals or LongPtr for pointers and handles.









                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 11 at 6:10

























                answered Nov 11 at 6:05









                K.Dᴀᴠɪs

                6,796112139




                6,796112139



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245069%2fhow-do-i-fix-error-for-64-bit-vba-ppt-converted-from-32-bit%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Darth Vader #20

                    How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

                    Ondo