Open custom binary file (*.quote) created with Excel VBA from Outlook attachment

ajloewen

New Member
Joined
Jan 3, 2023
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
Thank you to the MrExcel forum for all the help in the past. You have been my go-to resource for Excel VBA.

I have created an "application" in Excel VBA (Excel 2019) to create quotes. This application saves the quotes in a binary file using
Dim TargetPath As String
Dim myfilename As String
myfilename = TargetPath & (Range("N5").Value & " " & Range("C3").Value & " " & Range("C5").Value & ".quote")
Open myfilename For Binary As #file2Write
... code to build arrays
Put #file2Write, , VersionArray
Put #file2Write, , HeaderArray
Put #file2Write, , DetailArray
Put #file2Write, , FooterArray

The resulting binary *.quote file is small (about 10 KB) and easy to email colleagues.
In order to open the attached *.quote file in the Excel VBA application, users must save the file, then run the OpenQuote code in the "application".

Dim TargetPath As String
Dim myfilename As String
Dim strQuote As String
strQuote = Application.GetOpenFilename(FileFilter:="Quotes (*.quote), *.quote", Title:="Choose a quote file to open", MultiSelect:=False)
Open strQuote For Binary As #file2Read
... code to define arrays
Get #file2Read, , VersionArray
Get #file2Read, , HeaderArray
Get #file2Read, , DetailArray
Get #file2Read, , FooterArray

I'm looking for a way to bypass the save attachment to file, then run the OpenQuote VBA inside the "application".

Normally when you right-click on an attachment and select Open, the file will be located in a folder and have a full file name like...
C:\Users\userid\AppData\Local\Microsoft\Windows\INetCache\Content.Outlook\YXP32SQF\0001.0-ALS-230103.quote

There may be better ideas out there, but I think what I need is a method call the Excel "application" OpenQuote VBA and pass the full file name from the Outlook attachment.
I'd also like to be able to do something similar when right-clicking on the *.quote file from inside Windows File Explorer.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Forum statistics

Threads
1,214,518
Messages
6,119,996
Members
448,935
Latest member
ijat

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top