RockBennett
New Member
- Joined
- Jun 24, 2016
- Messages
- 1
Excel 2016 running on Windows 10. Excel .xlsm file opens normally from the Excel start screen. When opening the file using Explorer it executes SaveAs with a warning not to overwrite the existing file. The file contains an openworkbook macro that initiates a query table, then runs a data connection MS query, calls a macro to create a worksheet from the query, and finishes with an after query refresh and worksheet.protect.
The macros are show at the end of this statement.
The SaveAs occurrence initiates an overwrite the existing file alert, which I can answer "no" as a work around. But I know it can be fixed because opening the same file from another computer does not execute the SaveAs, and opening the file from the Excel start screen works fine. I have search and "rem'd" out the only SaveAs command with no success. I feel like it is somewhere in the options of the excel app, but cannot identify it.
Code:
_______________________________________
Private Sub Workbook_Open()
MsgBox "1. Close QuickBooks prior to clicking OK." & vbNewLine & "2. Excel 2007 or higher is required for this workbook." & vbNewLine & "3. Enable Refresh if prompted." & vbNewLine & "4. To create a Google Contacts Update file press Cntl + u."
Call Initialize_It
Sheets("QB Members").Select
ActiveSheet.Unprotect
Worksheets("QB Members").Activate
ActiveWorkbook.Connections("Customer List Query from QuickBooks Data QRemote"). _
Refresh
MsgBox "QB Member List was successfully updated"
End Sub
_________________________________________________
Dim X As New Class1
Sub Initialize_It()
Set X.qt = ThisWorkbook.Sheets(1).QueryTables(1)
End Sub
_________________________________________________
Public WithEvents qt As QueryTable
Private Sub qt_AfterRefresh(ByVal Success As Boolean)
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False
FLList
End Sub
__________________________________________________
Sub Macro1()
'
'Macro recorded by Rick Bennett 6/29/2016
'Update Google Members list and prepare "Google Contacts Update.csv" for import into Google Contacts
(I skipped all the copy and paste commands to movo data from one worksheet named 'QB Members' to one called 'Google Members')
'Fill Label Type Columns
Cells.Select
Range("B1").Activate
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
With Selection.Font
.Name = "Calibri"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.TintAndShade = 0
End With
Range("B2").Select
'Copy Google Members to "Google Contacts Update.csv"
Sheets("Google Members").Select
ActiveSheet.Copy
ActiveWorkbook.SaveAs Filename:="\\STM-QB-SERVER\Users\Public\STM Files\STM Member Files" & "\Google Contacts Update" & " " & Format(Now(), "mm-dd-yy"), FileFormat:=xlCSV
Range("B2").Select
ActiveWorkbook.Close
MsgBox "Google Contacts Update file was successfully created. Check STM Member Files for saved file."
'Clean up sheets
Windows("STM Members 062616 Excel 2007-2013.xlsm").Activate
Sheets("QB Members").Select
Application.CutCopyMode = False
Range("B2").Select
Sheets("Google Members").Select
Application.CutCopyMode = False
Range("B2").Select
Sheets("Google Members").Visible = False
Application.ScreenUpdating = False
End Sub
The macros are show at the end of this statement.
The SaveAs occurrence initiates an overwrite the existing file alert, which I can answer "no" as a work around. But I know it can be fixed because opening the same file from another computer does not execute the SaveAs, and opening the file from the Excel start screen works fine. I have search and "rem'd" out the only SaveAs command with no success. I feel like it is somewhere in the options of the excel app, but cannot identify it.
Code:
_______________________________________
Private Sub Workbook_Open()
MsgBox "1. Close QuickBooks prior to clicking OK." & vbNewLine & "2. Excel 2007 or higher is required for this workbook." & vbNewLine & "3. Enable Refresh if prompted." & vbNewLine & "4. To create a Google Contacts Update file press Cntl + u."
Call Initialize_It
Sheets("QB Members").Select
ActiveSheet.Unprotect
Worksheets("QB Members").Activate
ActiveWorkbook.Connections("Customer List Query from QuickBooks Data QRemote"). _
Refresh
MsgBox "QB Member List was successfully updated"
End Sub
_________________________________________________
Dim X As New Class1
Sub Initialize_It()
Set X.qt = ThisWorkbook.Sheets(1).QueryTables(1)
End Sub
_________________________________________________
Public WithEvents qt As QueryTable
Private Sub qt_AfterRefresh(ByVal Success As Boolean)
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False
FLList
End Sub
__________________________________________________
Sub Macro1()
'
'Macro recorded by Rick Bennett 6/29/2016
'Update Google Members list and prepare "Google Contacts Update.csv" for import into Google Contacts
(I skipped all the copy and paste commands to movo data from one worksheet named 'QB Members' to one called 'Google Members')
'Fill Label Type Columns
Cells.Select
Range("B1").Activate
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
With Selection.Font
.Name = "Calibri"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.TintAndShade = 0
End With
Range("B2").Select
'Copy Google Members to "Google Contacts Update.csv"
Sheets("Google Members").Select
ActiveSheet.Copy
ActiveWorkbook.SaveAs Filename:="\\STM-QB-SERVER\Users\Public\STM Files\STM Member Files" & "\Google Contacts Update" & " " & Format(Now(), "mm-dd-yy"), FileFormat:=xlCSV
Range("B2").Select
ActiveWorkbook.Close
MsgBox "Google Contacts Update file was successfully created. Check STM Member Files for saved file."
'Clean up sheets
Windows("STM Members 062616 Excel 2007-2013.xlsm").Activate
Sheets("QB Members").Select
Application.CutCopyMode = False
Range("B2").Select
Sheets("Google Members").Select
Application.CutCopyMode = False
Range("B2").Select
Sheets("Google Members").Visible = False
Application.ScreenUpdating = False
End Sub